Improved mute alerting (#1355)

* Use a simpler mute alert when viewing a post by a muted user

* Dont mute self-QPs when we're overriding a mute

* Fix types
This commit is contained in:
Paul Frazee 2023-09-01 12:30:02 -07:00 committed by GitHub
parent 3e96373903
commit 419ac2d0df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 63 additions and 6 deletions

24
src/lib/embeds.ts Normal file
View file

@ -0,0 +1,24 @@
import {
AppBskyFeedDefs,
AppBskyEmbedRecord,
AppBskyEmbedRecordWithMedia,
} from '@atproto/api'
export function isEmbedByEmbedder(
embed: AppBskyFeedDefs.PostView['embed'],
did: string,
): boolean {
if (!embed) {
return false
}
if (AppBskyEmbedRecord.isViewRecord(embed.record)) {
return embed.record.author.did === did
}
if (
AppBskyEmbedRecordWithMedia.isView(embed) &&
AppBskyEmbedRecord.isViewRecord(embed.record.record)
) {
return embed.record.record.author.did === did
}
return true
}