spec(backend/NoteCreateService): ローカルユーザーがまだ誰もフォローしていないリモートユーザーによる投稿のフィルターの条件の調整 (MisskeyIO#466)

Cherry-picked from 882924fe26d961c6ef5d7363b65855a380ff9371

Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com>
This commit is contained in:
まっちゃとーにゅ 2024-02-19 20:20:24 +09:00 committed by GitHub
parent 9c8e239963
commit f09098d616
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -366,7 +366,9 @@ export class NoteCreateService implements OnApplicationShutdown {
mentionedUsers = data.apMentions ?? await this.extractMentionedUsers(user, combinedTokens);
}
const willCauseNotification = mentionedUsers.filter(u => u.host === null).length > 0 || data.reply?.userHost === null || data.renote?.userHost === null;
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;
if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id });