diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-02-24 14:17:59 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-24 14:17:59 -0800 |
commit | 6254cf020aa14ead39438f90cd72f915a8639c61 (patch) | |
tree | a05d87dbf65c5708da74b460a9d30ccabdfd60f7 /src/lib | |
parent | 61a14043e51475b64c5c505dd10d81a0165bb3f2 (diff) | |
download | voidsky-6254cf020aa14ead39438f90cd72f915a8639c61.tar.zst |
Dedupe profile labels (#7833)
* dedupe labels * apply to postalerts
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/moderation.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/moderation.ts b/src/lib/moderation.ts index be503f4c7..cda7d3fa8 100644 --- a/src/lib/moderation.ts +++ b/src/lib/moderation.ts @@ -137,3 +137,15 @@ export function useLabelSubject({label}: {label: ComAtprotoLabelDefs.Label}): { } }, [label]) } + +export function unique( + value: ModerationCause, + index: number, + array: ModerationCause[], +) { + return ( + array.findIndex( + item => getModerationCauseKey(item) === getModerationCauseKey(value), + ) === index + ) +} |