diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fefabc513d98b7934d4bc2527f7cc8c30781f944..50f323fab057183187a88e7d8fe5aa10d3322e71 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -462,6 +462,8 @@ fix conflicts and *commit*! *after that commit*, do all the extra work, on the same branch: * copy all changes: + * from `NoteCreateService.create` to `NoteCreateService.import` (and + vice versa if `git` got confused!) * from `NoteCreateService` to `NoteEditService` * from `ApNoteService.createNote` to `ApNoteService.updateNote` * from `endoints/notes/create.ts` to `endoints/notes/edit.ts` diff --git a/packages/backend/src/core/NoteCreateService.ts b/packages/backend/src/core/NoteCreateService.ts index b985846f1c49e138d9edb2d073e154137e85172f..631d7074bd3b5bb5c664df0969cb0a195d69f047 100644 --- a/packages/backend/src/core/NoteCreateService.ts +++ b/packages/backend/src/core/NoteCreateService.ts @@ -266,6 +266,16 @@ export class NoteCreateService implements OnApplicationShutdown { } } + const hasProhibitedWords = await this.checkProhibitedWordsContain({ + cw: data.cw, + text: data.text, + pollChoices: data.poll?.choices, + }, meta.prohibitedWords); + + if (hasProhibitedWords) { + throw new IdentifiableError('689ee33f-f97c-479a-ac49-1b9f8140af99', 'Note contains prohibited words'); + } + const inSilencedInstance = this.utilityService.isSilencedHost(meta.silencedHosts, user.host); if (data.visibility === 'public' && inSilencedInstance && user.host !== null) { @@ -299,7 +309,7 @@ export class NoteCreateService implements OnApplicationShutdown { } // Check blocking - if (data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0)) { + if (data.renote && !this.isQuote(data)) { if (data.renote.userHost === null) { if (data.renote.userId !== user.id) { const blocked = await this.userBlockingService.checkBlocked(data.renote.userId, user.id); @@ -1018,7 +1028,7 @@ export class NoteCreateService implements OnApplicationShutdown { removeOnComplete: true, }); } - + // Pack the note const noteObj = await this.noteEntityService.pack(note, null, { skipHide: true, withReactionAndUserPairCache: true });