diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-08 09:08:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 09:08:42 -0800 |
commit | 74f8390f1d879350ebb6516fade2b1d83d1601e7 (patch) | |
tree | bf627b889faf1c4078562d5644d17422fee2df55 /src/state/models/feeds | |
parent | 4afed4be281b6319c328938e4ed757624a78b13c (diff) | |
download | voidsky-74f8390f1d879350ebb6516fade2b1d83d1601e7.tar.zst |
Move muted threads to new persistence + context (#1838)
Diffstat (limited to 'src/state/models/feeds')
-rw-r--r-- | src/state/models/feeds/notifications.ts | 4 | ||||
-rw-r--r-- | src/state/models/feeds/post.ts | 18 |
2 files changed, 2 insertions, 20 deletions
diff --git a/src/state/models/feeds/notifications.ts b/src/state/models/feeds/notifications.ts index 607e3038b..272d52881 100644 --- a/src/state/models/feeds/notifications.ts +++ b/src/state/models/feeds/notifications.ts @@ -18,6 +18,7 @@ import {RootStoreModel} from '../root-store' import {PostThreadModel} from '../content/post-thread' import {cleanError} from 'lib/strings/errors' import {logger} from '#/logger' +import {isThreadMuted} from '#/state/muted-threads' const GROUPABLE_REASONS = ['like', 'repost', 'follow'] const PAGE_SIZE = 30 @@ -550,8 +551,7 @@ export class NotificationsFeedModel { .filter(item => { const hideByLabel = item.shouldFilter let mutedThread = !!( - item.reasonSubjectRootUri && - this.rootStore.mutedThreads.uris.has(item.reasonSubjectRootUri) + item.reasonSubjectRootUri && isThreadMuted(item.reasonSubjectRootUri) ) return !hideByLabel && !mutedThread }) diff --git a/src/state/models/feeds/post.ts b/src/state/models/feeds/post.ts index d064edc21..4fa1213b5 100644 --- a/src/state/models/feeds/post.ts +++ b/src/state/models/feeds/post.ts @@ -75,10 +75,6 @@ export class PostsFeedItemModel { return this.post.uri } - get isThreadMuted() { - return this.rootStore.mutedThreads.uris.has(this.rootUri) - } - get moderation(): PostModeration { return moderatePost(this.post, this.rootStore.preferences.moderationOpts) } @@ -172,20 +168,6 @@ export class PostsFeedItemModel { } } - async toggleThreadMute() { - try { - if (this.isThreadMuted) { - this.rootStore.mutedThreads.uris.delete(this.rootUri) - track('Post:ThreadUnmute') - } else { - this.rootStore.mutedThreads.uris.add(this.rootUri) - track('Post:ThreadMute') - } - } catch (error) { - logger.error('Failed to toggle thread mute', {error}) - } - } - async delete() { try { await this.rootStore.agent.deletePost(this.post.uri) |