diff --git a/.changeset/clever-trainers-own.md b/.changeset/clever-trainers-own.md new file mode 100644 index 00000000..1ed98eeb --- /dev/null +++ b/.changeset/clever-trainers-own.md @@ -0,0 +1,5 @@ +--- +"@atproto/api": patch +--- + +Modify label-handling on user's own content to still apply blurring diff --git a/packages/api/src/moderation/decision.ts b/packages/api/src/moderation/decision.ts index b8a76206..92cc8ad5 100644 --- a/packages/api/src/moderation/decision.ts +++ b/packages/api/src/moderation/decision.ts @@ -78,15 +78,15 @@ export class ModerationDecision { ui(context: keyof ModerationBehavior): ModerationUI { const ui = new ModerationUI() - if (this.isMe) { - return ui - } for (const cause of this.causes) { if ( cause.type === 'blocking' || cause.type === 'blocked-by' || cause.type === 'block-other' ) { + if (this.isMe) { + continue + } if (context === 'profileList' || context === 'contentList') { ui.filters.push(cause) } @@ -101,6 +101,9 @@ export class ModerationDecision { } } } else if (cause.type === 'muted') { + if (this.isMe) { + continue + } if (context === 'profileList' || context === 'contentList') { ui.filters.push(cause) } @@ -114,6 +117,9 @@ export class ModerationDecision { } } } else if (cause.type === 'mute-word') { + if (this.isMe) { + continue + } if (context === 'contentList') { ui.filters.push(cause) } @@ -141,21 +147,21 @@ export class ModerationDecision { } } else if (cause.type === 'label') { if (context === 'profileList' && cause.target === 'account') { - if (cause.setting === 'hide') { + if (cause.setting === 'hide' && !this.isMe) { ui.filters.push(cause) } } else if ( context === 'contentList' && (cause.target === 'account' || cause.target === 'content') ) { - if (cause.setting === 'hide') { + if (cause.setting === 'hide' && !this.isMe) { ui.filters.push(cause) } } if (!cause.downgraded) { if (cause.behavior[context] === 'blur') { ui.blurs.push(cause) - if (cause.noOverride) { + if (cause.noOverride && !this.isMe) { ui.noOverride = true } } else if (cause.behavior[context] === 'alert') { diff --git a/packages/api/tests/moderation-behaviors.test.ts b/packages/api/tests/moderation-behaviors.test.ts index 686956fd..7e8b54a6 100644 --- a/packages/api/tests/moderation-behaviors.test.ts +++ b/packages/api/tests/moderation-behaviors.test.ts @@ -536,14 +536,26 @@ const SCENARIOS: SuiteScenarios = { subject: 'profile', author: 'self', labels: { account: ['!hide'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + displayName: ['blur'], + profileList: ['blur'], + profileView: ['blur'], + contentList: ['blur'], + contentView: ['blur'], + }, }, 'Self-profile: !hide on profile': { cfg: 'none', subject: 'profile', author: 'self', labels: { profile: ['!hide'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + displayName: ['blur'], + }, }, "Self-post: Imperative label ('!hide') on post": { @@ -551,21 +563,34 @@ const SCENARIOS: SuiteScenarios = { subject: 'post', author: 'self', labels: { post: ['!hide'] }, - behaviors: {}, + behaviors: { + contentView: ['blur'], + contentList: ['blur'], + }, }, "Self-post: Imperative label ('!hide') on author profile": { cfg: 'none', subject: 'post', author: 'self', labels: { profile: ['!hide'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + displayName: ['blur'], + }, }, "Self-post: Imperative label ('!hide') on author account": { cfg: 'none', subject: 'post', author: 'self', labels: { account: ['!hide'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + displayName: ['blur'], + contentList: ['blur'], + contentView: ['blur'], + }, }, "Self-post: Imperative label ('!warn') on post": { @@ -573,21 +598,33 @@ const SCENARIOS: SuiteScenarios = { subject: 'post', author: 'self', labels: { post: ['!warn'] }, - behaviors: {}, + behaviors: { + contentView: ['blur'], + contentList: ['blur'], + }, }, "Self-post: Imperative label ('!warn') on author profile": { cfg: 'none', subject: 'post', author: 'self', labels: { profile: ['!warn'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + displayName: ['blur'], + }, }, "Self-post: Imperative label ('!warn') on author account": { cfg: 'none', subject: 'post', author: 'self', labels: { account: ['!warn'] }, - behaviors: {}, + behaviors: { + avatar: ['blur'], + banner: ['blur'], + contentList: ['blur'], + contentView: ['blur'], + }, }, 'Mute/block: Blocking user': {