diff options
author | Ansh <anshnanda10@gmail.com> | 2023-08-15 13:32:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-15 11:32:57 -0700 |
commit | 77178844fd29e2b7b4637557c4068901da0ef4e8 (patch) | |
tree | b842ac1a9ed9f403346fdd9caeb6082d7b299cfd /src/lib/moderation.ts | |
parent | 94527a4d9eaa388239f59d91da252fe0bafac088 (diff) | |
download | voidsky-77178844fd29e2b7b4637557c4068901da0ef4e8.tar.zst |
[APP-798] add key to `ProfileCardPills` render method (#1158)
* add key to `ProfileCardPills` render method * More reliable key generation --------- Co-authored-by: Paul Frazee <pfrazee@gmail.com>
Diffstat (limited to 'src/lib/moderation.ts')
-rw-r--r-- | src/lib/moderation.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/moderation.ts b/src/lib/moderation.ts index a90c4dc9c..aadee0e74 100644 --- a/src/lib/moderation.ts +++ b/src/lib/moderation.ts @@ -92,3 +92,16 @@ export function isCauseALabelOnUri( } return cause.label.uri === uri } + +export function getModerationCauseKey(cause: ModerationCause): string { + const source = + cause.source.type === 'labeler' + ? cause.source.labeler.did + : cause.source.type === 'list' + ? cause.source.list.uri + : 'user' + if (cause.type === 'label') { + return `label:${cause.label.val}:${source}` + } + return `${cause.type}:${source}` +} |