diff options
author | Eric Bailey <git@esb.lol> | 2024-08-21 21:20:45 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-21 19:20:45 -0700 |
commit | 6616a6467ec53aa71e5f823c2d8c46dc01442703 (patch) | |
tree | 5e49d6916bc9b9fc71a475cf0d02f169c744bf59 /src/state/queries/threadgate.ts | |
parent | 56ab5e177fa2b24d0e5d9d969aa37532b96128da (diff) | |
download | voidsky-6616a6467ec53aa71e5f823c2d8c46dc01442703.tar.zst |
Detached QPs and hidden replies (#4878)
Co-authored-by: Hailey <me@haileyok.com>
Diffstat (limited to 'src/state/queries/threadgate.ts')
-rw-r--r-- | src/state/queries/threadgate.ts | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/src/state/queries/threadgate.ts b/src/state/queries/threadgate.ts deleted file mode 100644 index 8b6aeba6c..000000000 --- a/src/state/queries/threadgate.ts +++ /dev/null @@ -1,38 +0,0 @@ -import {AppBskyFeedDefs, AppBskyFeedThreadgate} from '@atproto/api' - -export type ThreadgateSetting = - | {type: 'nobody'} - | {type: 'mention'} - | {type: 'following'} - | {type: 'list'; list: unknown} - -export function threadgateViewToSettings( - threadgate: AppBskyFeedDefs.ThreadgateView | undefined, -): ThreadgateSetting[] { - const record = - threadgate && - AppBskyFeedThreadgate.isRecord(threadgate.record) && - AppBskyFeedThreadgate.validateRecord(threadgate.record).success - ? threadgate.record - : null - if (!record) { - return [] - } - if (!record.allow?.length) { - return [{type: 'nobody'}] - } - const settings: ThreadgateSetting[] = record.allow - .map(allow => { - let setting: ThreadgateSetting | undefined - if (allow.$type === 'app.bsky.feed.threadgate#mentionRule') { - setting = {type: 'mention'} - } else if (allow.$type === 'app.bsky.feed.threadgate#followingRule') { - setting = {type: 'following'} - } else if (allow.$type === 'app.bsky.feed.threadgate#listRule') { - setting = {type: 'list', list: allow.list} - } - return setting - }) - .filter(n => !!n) - return settings -} |