Show if you hid the reply or not
This commit is contained in:
@@ -17,7 +17,7 @@ export type AppModerationCause =
|
|||||||
| ModerationCause
|
| ModerationCause
|
||||||
| {
|
| {
|
||||||
type: 'reply-hidden'
|
type: 'reply-hidden'
|
||||||
source: {type: 'user'}
|
source: {type: 'user'; did: string}
|
||||||
priority: 6
|
priority: 6
|
||||||
downgraded?: boolean
|
downgraded?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import {msg} from '@lingui/macro'
|
|||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {useLabelDefinitions} from '#/state/preferences'
|
import {useLabelDefinitions} from '#/state/preferences'
|
||||||
|
import {useSession} from '#/state/session'
|
||||||
import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign'
|
import {CircleBanSign_Stroke2_Corner0_Rounded as CircleBanSign} from '#/components/icons/CircleBanSign'
|
||||||
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/icons/CircleInfo'
|
||||||
import {Props as SVGIconProps} from '#/components/icons/common'
|
import {Props as SVGIconProps} from '#/components/icons/common'
|
||||||
@@ -30,6 +31,7 @@ export interface ModerationCauseDescription {
|
|||||||
export function useModerationCauseDescription(
|
export function useModerationCauseDescription(
|
||||||
cause: ModerationCause | AppModerationCause | undefined,
|
cause: ModerationCause | AppModerationCause | undefined,
|
||||||
): ModerationCauseDescription {
|
): ModerationCauseDescription {
|
||||||
|
const {currentAccount} = useSession()
|
||||||
const {_, i18n} = useLingui()
|
const {_, i18n} = useLingui()
|
||||||
const {labelDefs, labelers} = useLabelDefinitions()
|
const {labelDefs, labelers} = useLabelDefinitions()
|
||||||
const globalLabelStrings = useGlobalLabelStrings()
|
const globalLabelStrings = useGlobalLabelStrings()
|
||||||
@@ -113,10 +115,15 @@ export function useModerationCauseDescription(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cause.type === 'reply-hidden') {
|
if (cause.type === 'reply-hidden') {
|
||||||
|
const isYou = currentAccount?.did === cause.source.did
|
||||||
return {
|
return {
|
||||||
icon: EyeSlash,
|
icon: EyeSlash,
|
||||||
name: _(msg`Post Hidden by Thread Author`),
|
name: isYou
|
||||||
description: _(msg`The author of this thread has hidden this post.`),
|
? _(msg`Post hidden by you`)
|
||||||
|
: _(msg`Post hidden by thread author`),
|
||||||
|
description: isYou
|
||||||
|
? _(msg`You hid this post.`)
|
||||||
|
: _(msg`The author of this thread has hidden this post.`),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cause.type === 'label') {
|
if (cause.type === 'label') {
|
||||||
@@ -158,5 +165,13 @@ export function useModerationCauseDescription(
|
|||||||
name: '',
|
name: '',
|
||||||
description: ``,
|
description: ``,
|
||||||
}
|
}
|
||||||
}, [labelDefs, labelers, globalLabelStrings, cause, _, i18n.locale])
|
}, [
|
||||||
|
labelDefs,
|
||||||
|
labelers,
|
||||||
|
globalLabelStrings,
|
||||||
|
cause,
|
||||||
|
_,
|
||||||
|
i18n.locale,
|
||||||
|
currentAccount?.did,
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,15 +215,17 @@ let PostThreadItemLoaded = ({
|
|||||||
const isPostHiddenByThreadgate = threadgateRecord?.hiddenReplies?.includes(
|
const isPostHiddenByThreadgate = threadgateRecord?.hiddenReplies?.includes(
|
||||||
post.uri,
|
post.uri,
|
||||||
)
|
)
|
||||||
const additionalPostAlerts: AppModerationCause[] = isPostHiddenByThreadgate
|
// TODO memoize
|
||||||
? [
|
const additionalPostAlerts: AppModerationCause[] =
|
||||||
{
|
threadgateRecord && isPostHiddenByThreadgate
|
||||||
type: 'reply-hidden',
|
? [
|
||||||
source: {type: 'user'},
|
{
|
||||||
priority: 6,
|
type: 'reply-hidden',
|
||||||
},
|
source: {type: 'user', did: new AtUri(threadgateRecord.post).host},
|
||||||
]
|
priority: 6,
|
||||||
: []
|
},
|
||||||
|
]
|
||||||
|
: []
|
||||||
|
|
||||||
const translatorUrl = getTranslatorLink(
|
const translatorUrl = getTranslatorLink(
|
||||||
record?.text || '',
|
record?.text || '',
|
||||||
|
|||||||
Reference in New Issue
Block a user