diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-05-04 00:55:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-04 00:55:33 -0500 |
commit | ab3074fdee44103424a58577f5c81c9d2436fc68 (patch) | |
tree | a494ee4fc5d07cf5ec4f162e4f5e0c23a449c13f /src/lib/labeling | |
parent | 33bf9c38695c24ede28d68810d1f6b2e68f86f5f (diff) | |
download | voidsky-ab3074fdee44103424a58577f5c81c9d2436fc68.tar.zst |
Add the !filter and !warn imperative labels (#580)
Diffstat (limited to 'src/lib/labeling')
-rw-r--r-- | src/lib/labeling/const.ts | 18 | ||||
-rw-r--r-- | src/lib/labeling/helpers.ts | 8 | ||||
-rw-r--r-- | src/lib/labeling/types.ts | 7 |
3 files changed, 31 insertions, 2 deletions
diff --git a/src/lib/labeling/const.ts b/src/lib/labeling/const.ts index f219cdb79..54cc732b9 100644 --- a/src/lib/labeling/const.ts +++ b/src/lib/labeling/const.ts @@ -6,7 +6,23 @@ export const ILLEGAL_LABEL_GROUP: LabelValGroup = { title: 'Illegal Content', warning: 'Illegal Content', values: ['csam', 'dmca-violation', 'nudity-nonconsentual'], - imagesOnly: false, // not applicable + imagesOnly: false, +} + +export const ALWAYS_FILTER_LABEL_GROUP: LabelValGroup = { + id: 'always-filter', + title: 'Content Warning', + warning: 'Content Warning', + values: ['!filter'], + imagesOnly: false, +} + +export const ALWAYS_WARN_LABEL_GROUP: LabelValGroup = { + id: 'always-warn', + title: 'Content Warning', + warning: 'Content Warning', + values: ['!warn'], + imagesOnly: false, } export const UNKNOWN_LABEL_GROUP: LabelValGroup = { diff --git a/src/lib/labeling/helpers.ts b/src/lib/labeling/helpers.ts index 5ec591cfb..71ea43c08 100644 --- a/src/lib/labeling/helpers.ts +++ b/src/lib/labeling/helpers.ts @@ -8,6 +8,8 @@ import { import { CONFIGURABLE_LABEL_GROUPS, ILLEGAL_LABEL_GROUP, + ALWAYS_FILTER_LABEL_GROUP, + ALWAYS_WARN_LABEL_GROUP, UNKNOWN_LABEL_GROUP, } from './const' import { @@ -34,6 +36,12 @@ export function getLabelValueGroup(labelVal: string): LabelValGroup { if (ILLEGAL_LABEL_GROUP.values.includes(labelVal)) { return ILLEGAL_LABEL_GROUP } + if (ALWAYS_FILTER_LABEL_GROUP.values.includes(labelVal)) { + return ALWAYS_FILTER_LABEL_GROUP + } + if (ALWAYS_WARN_LABEL_GROUP.values.includes(labelVal)) { + return ALWAYS_WARN_LABEL_GROUP + } if (CONFIGURABLE_LABEL_GROUPS[id].values.includes(labelVal)) { return CONFIGURABLE_LABEL_GROUPS[id] } diff --git a/src/lib/labeling/types.ts b/src/lib/labeling/types.ts index 20ecaa5b5..123c5d1f3 100644 --- a/src/lib/labeling/types.ts +++ b/src/lib/labeling/types.ts @@ -4,7 +4,12 @@ import {LabelPreferencesModel} from 'state/models/ui/preferences' export type Label = ComAtprotoLabelDefs.Label export interface LabelValGroup { - id: keyof LabelPreferencesModel | 'illegal' | 'unknown' + id: + | keyof LabelPreferencesModel + | 'illegal' + | 'always-filter' + | 'always-warn' + | 'unknown' title: string imagesOnly: boolean subtitle?: string |