Use default label prefs for pwi (#3271)
This commit is contained in:
		
							parent
							
								
									c9c3bd98b7
								
							
						
					
					
						commit
						5b4b8e47d9
					
				
					 1 changed files with 14 additions and 1 deletions
				
			
		|  | @ -5,6 +5,7 @@ import { | ||||||
|   BskyFeedViewPreference, |   BskyFeedViewPreference, | ||||||
|   ModerationOpts, |   ModerationOpts, | ||||||
|   AppBskyActorDefs, |   AppBskyActorDefs, | ||||||
|  |   BSKY_LABELER_DID, | ||||||
| } from '@atproto/api' | } from '@atproto/api' | ||||||
| 
 | 
 | ||||||
| import {track} from '#/lib/analytics/analytics' | import {track} from '#/lib/analytics/analytics' | ||||||
|  | @ -19,6 +20,7 @@ import { | ||||||
|   DEFAULT_THREAD_VIEW_PREFS, |   DEFAULT_THREAD_VIEW_PREFS, | ||||||
|   DEFAULT_LOGGED_OUT_PREFERENCES, |   DEFAULT_LOGGED_OUT_PREFERENCES, | ||||||
| } from '#/state/queries/preferences/const' | } from '#/state/queries/preferences/const' | ||||||
|  | import {DEFAULT_LOGGED_OUT_LABEL_PREFERENCES} from '#/state/queries/preferences/moderation' | ||||||
| import {STALE} from '#/state/queries' | import {STALE} from '#/state/queries' | ||||||
| import {useHiddenPosts, useLabelDefinitions} from '#/state/preferences' | import {useHiddenPosts, useLabelDefinitions} from '#/state/preferences' | ||||||
| import {saveLabelers} from '#/state/session/agent-config' | import {saveLabelers} from '#/state/session/agent-config' | ||||||
|  | @ -95,7 +97,18 @@ export function useModerationOpts() { | ||||||
|     } |     } | ||||||
|     return { |     return { | ||||||
|       userDid: currentAccount?.did, |       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, |       labelDefs, | ||||||
|     } |     } | ||||||
|   }, [override, currentAccount, labelDefs, prefs.data, hiddenPosts]) |   }, [override, currentAccount, labelDefs, prefs.data, hiddenPosts]) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue