Apply post-hide to quote posts (#2302)

zio/stable
Paul Frazee 2023-12-24 15:19:37 -08:00 committed by GitHub
parent e3d9a4f782
commit 51506efca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 30 additions and 1 deletions

View File

@ -1,4 +1,8 @@
import {moderatePost} from '@atproto/api' import {
AppBskyEmbedRecord,
AppBskyEmbedRecordWithMedia,
moderatePost,
} from '@atproto/api'
type ModeratePost = typeof moderatePost type ModeratePost = typeof moderatePost
type Options = Parameters<ModeratePost>[1] & { type Options = Parameters<ModeratePost>[1] & {
@ -25,5 +29,30 @@ export function moderatePost_wrapped(
} }
} }
if (subject.embed) {
let embedHidden = false
if (AppBskyEmbedRecord.isViewRecord(subject.embed.record)) {
embedHidden = hiddenPosts.includes(subject.embed.record.uri)
}
if (
AppBskyEmbedRecordWithMedia.isView(subject.embed) &&
AppBskyEmbedRecord.isViewRecord(subject.embed.record.record)
) {
embedHidden = hiddenPosts.includes(subject.embed.record.record.uri)
}
if (embedHidden) {
moderations.embed.filter = true
moderations.embed.blur = true
if (!moderations.embed.cause) {
moderations.embed.cause = {
// @ts-ignore Temporary extension to the moderation system -prf
type: 'post-hidden',
source: {type: 'user'},
priority: 1,
}
}
}
}
return moderations return moderations
} }