Skip to content

Commit

Permalink
Add muteword moderation behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Mar 9, 2024
1 parent 0d08b0b commit de06f7b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/api/src/moderation/decision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { AppBskyGraphDefs } from '../client/index'
import {
BLOCK_BEHAVIOR,
MUTE_BEHAVIOR,
MUTEWORD_BEHAVIOR,
HIDE_BEHAVIOR,
NOOP_BEHAVIOR,
Label,
Expand Down Expand Up @@ -101,6 +102,17 @@ export class ModerationDecision {
} else if (MUTE_BEHAVIOR[context] === 'inform') {
ui.informs.push(cause)
}
} else if (cause.type === 'mute-word') {
if (context === 'contentList') {
ui.filters.push(cause)
}
if (MUTEWORD_BEHAVIOR[context] === 'blur') {
ui.blurs.push(cause)
} else if (MUTEWORD_BEHAVIOR[context] === 'alert') {
ui.alerts.push(cause)
} else if (MUTEWORD_BEHAVIOR[context] === 'inform') {
ui.informs.push(cause)
}
} else if (cause.type === 'hidden') {
if (context === 'profileList' || context === 'contentList') {
ui.filters.push(cause)
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/moderation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export const MUTE_BEHAVIOR: ModerationBehavior = {
contentList: 'blur',
contentView: 'inform',
}
export const MUTEWORD_BEHAVIOR: ModerationBehavior = {
contentList: 'blur',
contentView: 'blur',
}
export const HIDE_BEHAVIOR: ModerationBehavior = {
contentList: 'blur',
contentView: 'blur',
Expand Down

0 comments on commit de06f7b

Please sign in to comment.