Skip to content

Commit f93be69

Browse files
committed
chore: use config instead of env variable to enable blockMentionsFromUnfamiliarRemoteUsers
1 parent b486212 commit f93be69

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

packages/backend/src/config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ type Source = {
100100
maxWebImageSize?: number;
101101
withRepliesInHomeTL?: boolean;
102102
withRepliesInUserList?: boolean;
103+
blockMentionsFromUnfamiliarRemoteUsers?: boolean;
103104
}
104105
};
105106

@@ -185,6 +186,7 @@ export type Config = {
185186
maxWebImageSize?: number;
186187
withRepliesInHomeTL?: boolean,
187188
withRepliesInUserList: boolean,
189+
blockMentionsFromUnfamiliarRemoteUsers: boolean;
188190
}
189191
};
190192

@@ -230,6 +232,7 @@ export function loadConfig(): Config {
230232
// to avoid merge conflict in the future, this is at top
231233
nirila: Object.assign({
232234
withRepliesInUserList: true,
235+
blockMentionsFromUnfamiliarRemoteUsers: false,
233236
}, config.nirila ?? {}),
234237
version,
235238
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,

packages/backend/src/core/NoteCreateService.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class NoteCreateService implements OnApplicationShutdown {
368368

369369
const willCauseNotification = mentionedUsers.filter(u => u.host === null).length > 0 || data.reply?.userHost === null || data.renote?.userHost === null;
370370

371-
if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) {
371+
if (this.config.nirila.blockMentionsFromUnfamiliarRemoteUsers && user.host !== null && willCauseNotification) {
372372
const userEntity = await this.usersRepository.findOneBy({ id: user.id });
373373
if ((userEntity?.followersCount ?? 0) === 0) {
374374
this.logger.error('Request rejected because user has no local followers', { user: user.id, note: data });

0 commit comments

Comments
 (0)