Skip to content

Commit

Permalink
Revert "enhance: コントロールパネルのモデレーションからスパムブロックの設定を変更できるように"
Browse files Browse the repository at this point in the history
This reverts commit 5f97b4b.
  • Loading branch information
hideki0403 committed Mar 1, 2024
1 parent afb5c02 commit 39f5531
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 52 deletions.
8 changes: 0 additions & 8 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5244,14 +5244,6 @@ export interface Locale extends ILocale {
* スワイプしてタブを切り替える
*/
"enableHorizontalSwipe": string;
/**
* 荒らしの可能性があるユーザーからのメンションをブロックする
*/
"blockMentionsFromUnfamiliarRemoteUsers": string;
/**
* このサーバーからのフォロワーがいないリモートユーザーの、メンションを含むノートをブロックするようにします。
*/
"blockMentionsFromUnfamiliarRemoteUsersDescription": string;
/**
* 読み込み中
*/
Expand Down
2 changes: 0 additions & 2 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,6 @@ hemisphere: "お住まいの地域"
withSensitive: "センシティブなファイルを含むノートを表示"
userSaysSomethingSensitive: "{name}のセンシティブなファイルを含む投稿"
enableHorizontalSwipe: "スワイプしてタブを切り替える"
blockMentionsFromUnfamiliarRemoteUsers: "荒らしの可能性があるユーザーからのメンションをブロックする"
blockMentionsFromUnfamiliarRemoteUsersDescription: "このサーバーからのフォロワーがいないリモートユーザーの、メンションを含むノートをブロックするようにします。"
loading: "読み込み中"
surrender: "やめる"
gameRetry: "リトライ"
Expand Down

This file was deleted.

11 changes: 3 additions & 8 deletions packages/backend/src/core/NoteCreateService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ import { UserBlockingService } from '@/core/UserBlockingService.js';
import { isReply } from '@/misc/is-reply.js';
import { trackPromise } from '@/misc/promise-tracker.js';
import { IdentifiableError } from '@/misc/identifiable-error.js';
import { LoggerService } from '@/core/LoggerService.js';
import type Logger from '@/logger.js';
import { isNotNull } from '@/misc/is-not-null.js';

type NotificationType = 'reply' | 'renote' | 'note' | 'quote' | 'mention';
Expand Down Expand Up @@ -157,7 +155,7 @@ type Option = {
export class NoteCreateService implements OnApplicationShutdown {
#shutdownController = new AbortController();

private logger: Logger;
public static ContainsProhibitedWordsError = class extends Error {};

constructor(
@Inject(DI.config)
Expand Down Expand Up @@ -226,10 +224,7 @@ export class NoteCreateService implements OnApplicationShutdown {
private instanceChart: InstanceChart,
private utilityService: UtilityService,
private userBlockingService: UserBlockingService,
private loggerService: LoggerService,
) {
this.logger = this.loggerService.getLogger('note-create-service');
}
) { }

@bindThis
public async create(user: {
Expand Down Expand Up @@ -377,7 +372,7 @@ export class NoteCreateService implements OnApplicationShutdown {

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

if (meta.blockMentionsFromUnfamiliarRemoteUsers && user.host !== null && willCauseNotification) {
if (process.env.MISSKEY_BLOCK_MENTIONS_FROM_UNFAMILIAR_REMOTE_USERS === 'true' && user.host !== null && willCauseNotification) {
const userEntity = await this.usersRepository.findOneBy({ id: user.id });
if ((userEntity?.followersCount ?? 0) === 0) {
this.logger.error('Request rejected because user has no local followers', { user: user.id, note: data });
Expand Down
5 changes: 0 additions & 5 deletions packages/backend/src/models/Meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,4 @@ export class MiMeta {
default: 20,
})
public ageRestrictionThreshold: number;

@Column('boolean', {
default: true,
})
public blockMentionsFromUnfamiliarRemoteUsers: boolean;
}
5 changes: 0 additions & 5 deletions packages/backend/src/server/api/endpoints/admin/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,10 +539,6 @@ export const meta = {
type: 'string',
optional: false, nullable: false,
},
blockMentionsFromUnfamiliarRemoteUsers: {
type: 'boolean',
optional: false, nullable: false,
},
},
},
} as const;
Expand Down Expand Up @@ -689,7 +685,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
disableEntranceFeatureTimeline: instance.disableEntranceFeatureTimeline,
enableAgeRestriction: instance.enableAgeRestriction,
ageRestrictionThreshold: instance.ageRestrictionThreshold,
blockMentionsFromUnfamiliarRemoteUsers: instance.blockMentionsFromUnfamiliarRemoteUsers,
};
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export const paramDef = {
disableEntranceFeatureTimeline: { type: 'boolean' },
enableAgeRestriction: { type: 'boolean' },
ageRestrictionThreshold: { type: 'integer' },
blockMentionsFromUnfamiliarRemoteUsers: { type: 'boolean' },
silencedHosts: {
type: 'array',
nullable: true,
Expand Down Expand Up @@ -684,10 +683,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.bannedEmailDomains = ps.bannedEmailDomains;
}

if (ps.blockMentionsFromUnfamiliarRemoteUsers !== undefined) {
set.blockMentionsFromUnfamiliarRemoteUsers = ps.blockMentionsFromUnfamiliarRemoteUsers;
}

const before = await this.metaService.fetch(true);

await this.metaService.update(set);
Expand Down
8 changes: 0 additions & 8 deletions packages/frontend/src/pages/admin/moderation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.emailRequiredForSignup }}</template>
</MkSwitch>

<MkSwitch v-model="blockMentionsFromUnfamiliarRemoteUsers">
<template #label>{{ i18n.ts.blockMentionsFromUnfamiliarRemoteUsers }}<span class="_beta">{{ i18n.ts.originalFeature }}</span></template>
<template #caption>{{ i18n.ts.blockMentionsFromUnfamiliarRemoteUsersDescription }} Cherry-picked from Misskey.io (https://github.com/MisskeyIO/misskey/commit/82cc3987c13db4ad0da1589386027c222ce85ff8)</template>
</MkSwitch>

<MkSwitch v-if="enableRegistration" v-model="enableRegistrationLimit">
<template #label>{{ i18n.ts.enableRegistrationLimit }}<span class="_beta">{{ i18n.ts.originalFeature }}</span></template>
<template #caption>{{ i18n.ts.enableRegistrationLimitDescription }}</template>
Expand Down Expand Up @@ -134,7 +129,6 @@ const prohibitedWords = ref('');
const hiddenTags = ref('');
const tosUrl = ref<string | null>(null);
const privacyPolicyUrl = ref<string | null>(null);
const blockMentionsFromUnfamiliarRemoteUsers = ref(false);

async function init() {
const meta = await misskeyApi('admin/meta');
Expand All @@ -153,7 +147,6 @@ async function init() {
preservedUsernames.value = meta.preservedUsernames.join('\n');
tosUrl.value = meta.tosUrl;
privacyPolicyUrl.value = meta.privacyPolicyUrl;
blockMentionsFromUnfamiliarRemoteUsers.value = meta.blockMentionsFromUnfamiliarRemoteUsers;
}

function save() {
Expand All @@ -173,7 +166,6 @@ function save() {
prohibitedWords: prohibitedWords.value.split('\n'),
hiddenTags: hiddenTags.value.split('\n'),
preservedUsernames: preservedUsernames.value.split('\n'),
blockMentionsFromUnfamiliarRemoteUsers: blockMentionsFromUnfamiliarRemoteUsers.value,
}).then(() => {
fetchInstance(true);
});
Expand Down

0 comments on commit 39f5531

Please sign in to comment.