1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-23 14:46:40 +09:00

enhance(backend): 投票の選択肢に対してもセンシティブワード検出を行うように (MisskeyIO#630)

This commit is contained in:
CyberRex 2024-05-22 21:55:27 +09:00 committed by GitHub
parent 38c1075591
commit 557601f501
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {
@ -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 });