Add the !filter and !warn imperative labels (#580)

This commit is contained in:
Paul Frazee 2023-05-04 00:55:33 -05:00 committed by GitHub
parent 33bf9c3869
commit ab3074fdee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 3 deletions

View file

@ -4,7 +4,12 @@ import {isObj, hasProp} from 'lib/type-guards'
import {ComAtprotoLabelDefs} from '@atproto/api'
import {LabelValGroup} from 'lib/labeling/types'
import {getLabelValueGroup} from 'lib/labeling/helpers'
import {UNKNOWN_LABEL_GROUP, ILLEGAL_LABEL_GROUP} from 'lib/labeling/const'
import {
UNKNOWN_LABEL_GROUP,
ILLEGAL_LABEL_GROUP,
ALWAYS_FILTER_LABEL_GROUP,
ALWAYS_WARN_LABEL_GROUP,
} from 'lib/labeling/const'
const deviceLocales = getLocales()
@ -94,6 +99,10 @@ export class PreferencesModel {
const group = getLabelValueGroup(label.val)
if (group.id === 'illegal') {
return {pref: 'hide', desc: ILLEGAL_LABEL_GROUP}
} else if (group.id === 'always-filter') {
return {pref: 'hide', desc: ALWAYS_FILTER_LABEL_GROUP}
} else if (group.id === 'always-warn') {
return {pref: 'warn', desc: ALWAYS_WARN_LABEL_GROUP}
} else if (group.id === 'unknown') {
continue
}