diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-08-03 22:08:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-03 22:08:30 -0700 |
commit | b154d3ea21bcca48594aa397420b0f6718dbf7f3 (patch) | |
tree | 31d51cd32cfeabc78d647cc068f5f84551f7a1b0 /src/state/models/feeds/posts-slice.ts | |
parent | 3ae5a6b63134f6aa57eba4fba18e4ad136623e20 (diff) | |
download | voidsky-b154d3ea21bcca48594aa397420b0f6718dbf7f3.tar.zst |
Labeling & moderation updates [DRAFT] (#1057)
* First pass moving to the new labeling sdk (it compiles) * Correct behaviors around interpreting label moderation * Improve moderation state rendering * Improve hiders and alerts * Improve handling of mutes * Improve profile warnings * Add profile blurring to profile header * Add blocks to test cases * Render labels on profile cards, do not filter * Filter profiles from suggestions using moderation * Apply profile blurring to ProfileCard * Handle blocked and deleted quote posts * Temporarily translate content filtering settings to new labels * Fix types * Tune ContentHider & PostHider click targets * Put a warning on profilecard label pills * Fix screenhider learnmore link on mobile * Enforce no-override on user avatar * Dont enumerate profile blur-media labels in alerts * Fixes to muted posts (esp quotes of muted users) * Fixes to account/profile warnings * Bump @atproto/api@0.5.0 * Bump @atproto/api@0.5.1 * Fix tests * 1.43 * Remove log * Bump @atproto/api@0.5.2
Diffstat (limited to 'src/state/models/feeds/posts-slice.ts')
-rw-r--r-- | src/state/models/feeds/posts-slice.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/state/models/feeds/posts-slice.ts b/src/state/models/feeds/posts-slice.ts index 239bc5b6a..c02faed3b 100644 --- a/src/state/models/feeds/posts-slice.ts +++ b/src/state/models/feeds/posts-slice.ts @@ -1,7 +1,6 @@ import {makeAutoObservable} from 'mobx' import {RootStoreModel} from '../root-store' import {FeedViewPostsSlice} from 'lib/api/feed-manip' -import {mergePostModerations} from 'lib/labeling/helpers' import {PostsFeedItemModel} from './post' let _idCounter = 0 @@ -55,7 +54,20 @@ export class PostsFeedSliceModel { } get moderation() { - return mergePostModerations(this.items.map(item => item.moderation)) + // prefer the most stringent item + const topItem = this.items.find(item => item.moderation.content.filter) + if (topItem) { + return topItem.moderation + } + // otherwise just use the first one + return this.items[0].moderation + } + + shouldFilter(ignoreFilterForDid: string | undefined): boolean { + const mods = this.items + .filter(item => item.post.author.did !== ignoreFilterForDid) + .map(item => item.moderation) + return !!mods.find(mod => mod.content.filter) } containsUri(uri: string) { |