Fix to embed labels lookup (#550)

* Fix to embed labels lookup

* Fix lint

* Fix lint
zio/stable
Paul Frazee 2023-04-27 15:01:38 -05:00 committed by GitHub
parent 301c2e5beb
commit 173e06f866
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 12 deletions

View File

@ -2,7 +2,6 @@ import {
AppBskyActorDefs,
AppBskyEmbedRecordWithMedia,
AppBskyEmbedRecord,
AppBskyFeedPost,
AppBskyEmbedImages,
AppBskyEmbedExternal,
} from '@atproto/api'
@ -229,12 +228,10 @@ export function getEmbedLabels(embed?: Embed): Label[] {
return []
}
if (
AppBskyEmbedRecordWithMedia.isView(embed) &&
AppBskyEmbedRecord.isViewRecord(embed.record.record) &&
AppBskyFeedPost.isRecord(embed.record.record.value) &&
AppBskyFeedPost.validateRecord(embed.record.record.value).success
AppBskyEmbedRecord.isView(embed) &&
AppBskyEmbedRecord.isViewRecord(embed.record)
) {
return embed.record.record.labels || []
return embed.record.labels || []
}
return []
}
@ -312,9 +309,10 @@ function warnContent(reason: string) {
}
}
function warnImages(reason: string) {
return {
behavior: ModerationBehaviorCode.WarnImages,
reason,
}
}
// TODO
// function warnImages(reason: string) {
// return {
// behavior: ModerationBehaviorCode.WarnImages,
// reason,
// }
// }