This commit is contained in:
mattyatea 2024-02-18 10:55:16 +09:00
parent 4683ead75f
commit a7bc276e01

View file

@ -438,11 +438,10 @@ export class NoteCreateService implements OnApplicationShutdown {
const willCauseNotification = mentionedUsers.filter(u => u.host === null).length > 0 || data.reply?.userHost === null || data.renote?.userHost === null; const willCauseNotification = mentionedUsers.filter(u => u.host === null).length > 0 || data.reply?.userHost === null || data.renote?.userHost === null;
if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) { if (user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id }); const userEntity = await this.usersRepository.findOneBy({ id: user.id });
if ((userEntity?.followersCount ?? 0) === 0) { if ((userEntity?.followersCount ?? 0) === 0) {
this.logger.error('Request rejected because user has no local followers', { user: user.id, note: data }); throw new NoteCreateService.ContainsProhibitedWordsError();
throw new IdentifiableError('e11b3a16-f543-4885-8eb1-66cad131dbfd', 'Notes including mentions, replies, or renotes from remote users are not allowed until user has at least one local follower.');
} }
} }