diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-04-27 13:15:04 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-04-27 13:15:04 -0500 |
commit | 301c2e5bebb2a9077dd0692459a71eadb6c6d1dd (patch) | |
tree | 1a7cdd0fd895dd70ade830bc7e9e9ecc3a93b66e /src/state/models/content/post-thread.ts | |
parent | da06b608f2992b4a18ca51b8e6919ef4d32aad7a (diff) | |
parent | 1d50ddb378d5c6954d4cf8a6145b4486b9497107 (diff) | |
download | voidsky-301c2e5bebb2a9077dd0692459a71eadb6c6d1dd.tar.zst |
Merge branch 'main' of github.com:bluesky-social/social-app into main
Diffstat (limited to 'src/state/models/content/post-thread.ts')
-rw-r--r-- | src/state/models/content/post-thread.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/state/models/content/post-thread.ts b/src/state/models/content/post-thread.ts index 76cab5c61..8f9a55032 100644 --- a/src/state/models/content/post-thread.ts +++ b/src/state/models/content/post-thread.ts @@ -10,6 +10,13 @@ import {RootStoreModel} from '../root-store' import * as apilib from 'lib/api/index' import {cleanError} from 'lib/strings/errors' import {updateDataOptimistically} from 'lib/async/revertible' +import {PostLabelInfo, PostModeration} from 'lib/labeling/types' +import { + getEmbedLabels, + filterAccountLabels, + filterProfileLabels, + getPostModeration, +} from 'lib/labeling/helpers' export class PostThreadItemModel { // ui state @@ -46,6 +53,21 @@ export class PostThreadItemModel { return this.rootStore.mutedThreads.uris.has(this.rootUri) } + get labelInfo(): PostLabelInfo { + return { + postLabels: (this.post.labels || []).concat( + getEmbedLabels(this.post.embed), + ), + accountLabels: filterAccountLabels(this.post.author.labels), + profileLabels: filterProfileLabels(this.post.author.labels), + isMuted: this.post.author.viewer?.muted || false, + } + } + + get moderation(): PostModeration { + return getPostModeration(this.rootStore, this.labelInfo) + } + constructor( public rootStore: RootStoreModel, v: AppBskyFeedDefs.ThreadViewPost, |