Skip to content

Commit

Permalink
enhance(backend): 投票の選択肢に対してもセンシティブワード検出を行うように (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRex0 authored May 22, 2024
1 parent 38c1075 commit 557601f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export class NoteCreateService implements OnApplicationShutdown {

if (data.visibility === 'public' && data.channel == null) {
const sensitiveWords = meta.sensitiveWords;
if (this.utilityService.isKeyWordIncluded(data.cw ?? data.text ?? '', sensitiveWords)) {
if (this.utilityService.isKeyWordIncluded(data.cw ?? this.utilityService.concatNoteContentsForKeyWordCheck({ text: data.text, pollChoices: data.poll?.choices }), sensitiveWords)) {
data.visibility = 'home';
this.logger.warn('Visibility changed to home because sensitive words are included', { user: user.id, note: data });
} else if (!policies.canPublicNote) {
Expand Down Expand Up @@ -371,7 +371,7 @@ export class NoteCreateService implements OnApplicationShutdown {

const willCauseNotification = mentionedUsers.some(u => u.host === null)
|| (data.visibility === 'specified' && data.visibleUsers?.some(u => u.host === null))
|| data.reply?.userHost === null || (this.isQuote(data) && data.renote?.userHost === null) || false;
|| data.reply?.userHost === null || (this.isQuote(data) && data.renote.userHost === null) || false;

if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id });
Expand Down

0 comments on commit 557601f

Please sign in to comment.