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