merge: check prohibited words when editing note (!429)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/429

Approved-by: Marie <marie@kaifa.ch>
Approved-by: Amelia Yukii <amelia.yukii@shourai.de>
This commit is contained in:
Marie 2024-02-19 19:19:27 +00:00
commit 6931f50af5
1 changed files with 4 additions and 0 deletions

View File

@ -275,6 +275,10 @@ export class NoteEditService implements OnApplicationShutdown {
} }
} }
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', meta.prohibitedWords)) {
throw new NoteEditService.ContainsProhibitedWordsError();
}
const inSilencedInstance = this.utilityService.isSilencedHost((meta).silencedHosts, user.host); const inSilencedInstance = this.utilityService.isSilencedHost((meta).silencedHosts, user.host);
if (data.visibility === 'public' && inSilencedInstance && user.host !== null) { if (data.visibility === 'public' && inSilencedInstance && user.host !== null) {