Skip to content

Commit

Permalink
Use default label prefs for pwi (#3271)
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey authored Mar 19, 2024
1 parent c9c3bd9 commit 5b4b8e4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/state/queries/preferences/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BskyFeedViewPreference,
ModerationOpts,
AppBskyActorDefs,
BSKY_LABELER_DID,
} from '@atproto/api'

import {track} from '#/lib/analytics/analytics'
Expand All @@ -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'
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit 5b4b8e4

Please sign in to comment.