Hide posts tool (#2299)
* Set up hidden posts persisted state * Wrap moderatePost * Integrate hidden posts into moderation * Complete hide-post behaviors --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
This commit is contained in:
		
							parent
							
								
									28e0df595f
								
							
						
					
					
						commit
						b199405134
					
				
					 12 changed files with 151 additions and 12 deletions
				
			
		|  | @ -19,6 +19,7 @@ import { | |||
| } from '#/state/queries/preferences/const' | ||||
| import {getModerationOpts} from '#/state/queries/preferences/moderation' | ||||
| import {STALE} from '#/state/queries' | ||||
| import {useHiddenPosts} from '#/state/preferences/hidden-posts' | ||||
| 
 | ||||
| export * from '#/state/queries/preferences/types' | ||||
| export * from '#/state/queries/preferences/moderation' | ||||
|  | @ -94,15 +95,21 @@ export function usePreferencesQuery() { | |||
| export function useModerationOpts() { | ||||
|   const {currentAccount} = useSession() | ||||
|   const prefs = usePreferencesQuery() | ||||
|   const hiddenPosts = useHiddenPosts() | ||||
|   const opts = useMemo(() => { | ||||
|     if (!prefs.data) { | ||||
|       return | ||||
|     } | ||||
|     return getModerationOpts({ | ||||
|     const moderationOpts = getModerationOpts({ | ||||
|       userDid: currentAccount?.did || '', | ||||
|       preferences: prefs.data, | ||||
|     }) | ||||
|   }, [currentAccount?.did, prefs.data]) | ||||
| 
 | ||||
|     return { | ||||
|       ...moderationOpts, | ||||
|       hiddenPosts, | ||||
|     } | ||||
|   }, [currentAccount?.did, prefs.data, hiddenPosts]) | ||||
|   return opts | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue