diff options
author | Samuel Newman <mozzius@protonmail.com> | 2024-03-19 19:51:35 +0000 |
---|---|---|
committer | Samuel Newman <mozzius@protonmail.com> | 2024-03-19 19:51:35 +0000 |
commit | 4794ab6b9a39d06bb0d1b7c64a315e4ac5e3336a (patch) | |
tree | 743b94dff5a4a3b4b2304c53b984b8a3dc67aaa2 /src/state | |
parent | a1c4f19731878f7026d398d28e475bbeb7de824a (diff) | |
parent | 5621c8042510c86f6c4fa63b5c5ce9fc02b0bf8e (diff) | |
download | voidsky-4794ab6b9a39d06bb0d1b7c64a315e4ac5e3336a.tar.zst |
Merge remote-tracking branch 'origin/main' into samuel/alf-login
Diffstat (limited to 'src/state')
-rw-r--r-- | src/state/queries/actor-autocomplete.ts | 8 | ||||
-rw-r--r-- | src/state/queries/preferences/index.ts | 15 | ||||
-rw-r--r-- | src/state/shell/composer.tsx | 7 |
3 files changed, 17 insertions, 13 deletions
diff --git a/src/state/queries/actor-autocomplete.ts b/src/state/queries/actor-autocomplete.ts index f14b3d65f..e6bf04ba3 100644 --- a/src/state/queries/actor-autocomplete.ts +++ b/src/state/queries/actor-autocomplete.ts @@ -101,13 +101,7 @@ function computeSuggestions( } for (const item of searched) { if (!items.find(item2 => item2.handle === item.handle)) { - items.push({ - did: item.did, - handle: item.handle, - displayName: item.displayName, - avatar: item.avatar, - labels: item.labels, - }) + items.push(item) } } return items.filter(profile => { diff --git a/src/state/queries/preferences/index.ts b/src/state/queries/preferences/index.ts index cfc5c5bbe..f9cd59cda 100644 --- a/src/state/queries/preferences/index.ts +++ b/src/state/queries/preferences/index.ts @@ -5,6 +5,7 @@ import { BskyFeedViewPreference, ModerationOpts, AppBskyActorDefs, + BSKY_LABELER_DID, } from '@atproto/api' import {track} from '#/lib/analytics/analytics' @@ -19,6 +20,7 @@ import { DEFAULT_THREAD_VIEW_PREFS, DEFAULT_LOGGED_OUT_PREFERENCES, } from '#/state/queries/preferences/const' +import {DEFAULT_LOGGED_OUT_LABEL_PREFERENCES} from '#/state/queries/preferences/moderation' import {STALE} from '#/state/queries' import {useHiddenPosts, useLabelDefinitions} from '#/state/preferences' import {saveLabelers} from '#/state/session/agent-config' @@ -95,7 +97,18 @@ export function useModerationOpts() { } return { userDid: currentAccount?.did, - prefs: {...prefs.data.moderationPrefs, hiddenPosts: hiddenPosts || []}, + prefs: { + ...prefs.data.moderationPrefs, + labelers: prefs.data.moderationPrefs.labelers.length + ? prefs.data.moderationPrefs.labelers + : [ + { + did: BSKY_LABELER_DID, + labels: DEFAULT_LOGGED_OUT_LABEL_PREFERENCES, + }, + ], + hiddenPosts: hiddenPosts || [], + }, labelDefs, } }, [override, currentAccount, labelDefs, prefs.data, hiddenPosts]) diff --git a/src/state/shell/composer.tsx b/src/state/shell/composer.tsx index a09e8fba9..5b4e50543 100644 --- a/src/state/shell/composer.tsx +++ b/src/state/shell/composer.tsx @@ -3,6 +3,7 @@ import { AppBskyEmbedRecord, AppBskyRichtextFacet, ModerationDecision, + AppBskyActorDefs, } from '@atproto/api' import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' @@ -10,11 +11,7 @@ export interface ComposerOptsPostRef { uri: string cid: string text: string - author: { - handle: string - displayName?: string - avatar?: string - } + author: AppBskyActorDefs.ProfileViewBasic embed?: AppBskyEmbedRecord.ViewRecord['embed'] moderation?: ModerationDecision } |