Skip to content

Commit

Permalink
spec(backend/NoteCreateService): ローカルユーザーがまだ誰もフォローしていないリモートユーザーによる投稿の…
Browse files Browse the repository at this point in the history
…フィルターの条件の調整 (MisskeyIO#466)

Cherry-picked from 882924f

Co-authored-by: Ebise Lutica <7106976+EbiseLutica@users.noreply.github.com>
  • Loading branch information
2 people authored and hideki0403 committed Feb 26, 2024
1 parent ac3873e commit b621144
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,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 (meta.blockMentionsFromUnfamiliarRemoteUsers && user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id });
Expand Down

0 comments on commit b621144

Please sign in to comment.