Handle muting correctly

This commit is contained in:
Paul Frazee
2024-02-15 13:13:26 -08:00
parent 1b33b88ae2
commit ef1a5ca2fd
8 changed files with 29 additions and 48 deletions
+5
View File
@@ -1,6 +1,7 @@
import React from 'react'
import {
ModerationCause,
ModerationUI,
LABEL_GROUPS,
LabelGroupDefinition,
AppBskyModerationDefs,
@@ -22,6 +23,10 @@ export function getModerationCauseKey(cause: ModerationCause): string {
return `${cause.type}:${source}`
}
export function isJustAMute(modui: ModerationUI): boolean {
return modui.filters.length === 1 && modui.filters[0].type === 'muted'
}
export function getLabelGroupsFromLabels(labels: string[]) {
const groups: LabelGroupDefinition[] = []
@@ -58,18 +58,12 @@ export function useModerationCauseDescription(
if (cause.type === 'muted') {
if (cause.source.type === 'list') {
return {
name:
context === 'account'
? _(msg`Muted by "${cause.source.list.name}"`)
: _(msg`Post by muted user ("${cause.source.list.name}")`),
name: _(msg`Muted by "${cause.source.list.name}"`),
description: _(msg`You have muted this user`),
}
} else {
return {
name:
context === 'account'
? _(msg`Muted User`)
: _(msg`Post by muted user`),
name: _(msg`Muted User`),
description: _(msg`You have muted this user`),
}
}