feat: ユーザーの名前に禁止ワードを設定できるように (#14756)
* wip
* 🎨
* Enhance: モデレーター以上は制限の影響を受けないように
* refactor
* better error handling
* fix
* Revert "better error handling"
This reverts commit 5670b29cfa
.
* error handling
* エラーが出ないのを修正
* translation
* Update Changelog
* status code
* ✌️
* モデレーター以上は影響ないことを明記
* 🎨
* update changelog
* spdx
* Update update.ts
* refactor
* eliminate `screen name`
* remove untracked file
---------
Co-authored-by: KanariKanaru <93921745+kanarikanaru@users.noreply.github.com>
This commit is contained in:
parent
c4c69cd267
commit
45d42b8641
|
@ -4,6 +4,9 @@
|
||||||
7日間活動していない場合は自動的に招待制へと移行(コントロールパネル -> モデレーション -> "誰でも新規登録できるようにする"をオフに変更)するようになりました。
|
7日間活動していない場合は自動的に招待制へと移行(コントロールパネル -> モデレーション -> "誰でも新規登録できるようにする"をオフに変更)するようになりました。
|
||||||
詳細な経緯は https://github.com/misskey-dev/misskey/issues/13437 をご確認ください。
|
詳細な経緯は https://github.com/misskey-dev/misskey/issues/13437 をご確認ください。
|
||||||
|
|
||||||
|
### General
|
||||||
|
- Feat: ユーザーの名前に禁止ワードを設定できるように
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: l10nの更新
|
- Enhance: l10nの更新
|
||||||
- Fix: メールアドレス不要でCaptchaが有効な場合にアカウント登録完了後自動でのログインに失敗する問題を修正
|
- Fix: メールアドレス不要でCaptchaが有効な場合にアカウント登録完了後自動でのログインに失敗する問題を修正
|
||||||
|
|
|
@ -5170,6 +5170,22 @@ export interface Locale extends ILocale {
|
||||||
* CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>
|
* CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>
|
||||||
*/
|
*/
|
||||||
"testCaptchaWarning": string;
|
"testCaptchaWarning": string;
|
||||||
|
/**
|
||||||
|
* 禁止ワード(ユーザーの名前)
|
||||||
|
*/
|
||||||
|
"prohibitedWordsForNameOfUser": string;
|
||||||
|
/**
|
||||||
|
* このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。
|
||||||
|
*/
|
||||||
|
"prohibitedWordsForNameOfUserDescription": string;
|
||||||
|
/**
|
||||||
|
* 変更しようとした名前に禁止された文字列が含まれています
|
||||||
|
*/
|
||||||
|
"yourNameContainsProhibitedWords": string;
|
||||||
|
/**
|
||||||
|
* 名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。
|
||||||
|
*/
|
||||||
|
"yourNameContainsProhibitedWordsDescription": string;
|
||||||
"_abuseUserReport": {
|
"_abuseUserReport": {
|
||||||
/**
|
/**
|
||||||
* 転送
|
* 転送
|
||||||
|
|
|
@ -1288,6 +1288,10 @@ passkeyVerificationSucceededButPasswordlessLoginDisabled: "パスキーの検証
|
||||||
messageToFollower: "フォロワーへのメッセージ"
|
messageToFollower: "フォロワーへのメッセージ"
|
||||||
target: "対象"
|
target: "対象"
|
||||||
testCaptchaWarning: "CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>"
|
testCaptchaWarning: "CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>"
|
||||||
|
prohibitedWordsForNameOfUser: "禁止ワード(ユーザーの名前)"
|
||||||
|
prohibitedWordsForNameOfUserDescription: "このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。"
|
||||||
|
yourNameContainsProhibitedWords: "変更しようとした名前に禁止された文字列が含まれています"
|
||||||
|
yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。"
|
||||||
|
|
||||||
_abuseUserReport:
|
_abuseUserReport:
|
||||||
forward: "転送"
|
forward: "転送"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
/*
|
||||||
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
||||||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
*/
|
||||||
|
|
||||||
|
export class ProhibitedWordsForNameOfUser1728634286056 {
|
||||||
|
async up(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "prohibitedWordsForNameOfUser" character varying(1024) array NOT NULL DEFAULT '{}'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async down(queryRunner) {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "prohibitedWordsForNameOfUser"`);
|
||||||
|
}
|
||||||
|
}
|
|
@ -81,6 +81,11 @@ export class MiMeta {
|
||||||
})
|
})
|
||||||
public prohibitedWords: string[];
|
public prohibitedWords: string[];
|
||||||
|
|
||||||
|
@Column('varchar', {
|
||||||
|
length: 1024, array: true, default: '{}',
|
||||||
|
})
|
||||||
|
public prohibitedWordsForNameOfUser: string[];
|
||||||
|
|
||||||
@Column('varchar', {
|
@Column('varchar', {
|
||||||
length: 1024, array: true, default: '{}',
|
length: 1024, array: true, default: '{}',
|
||||||
})
|
})
|
||||||
|
|
|
@ -177,6 +177,13 @@ export const meta = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
prohibitedWordsForNameOfUser: {
|
||||||
|
type: 'array',
|
||||||
|
optional: false, nullable: false,
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
bannedEmailDomains: {
|
bannedEmailDomains: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
optional: true, nullable: false,
|
optional: true, nullable: false,
|
||||||
|
@ -586,6 +593,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
mediaSilencedHosts: instance.mediaSilencedHosts,
|
mediaSilencedHosts: instance.mediaSilencedHosts,
|
||||||
sensitiveWords: instance.sensitiveWords,
|
sensitiveWords: instance.sensitiveWords,
|
||||||
prohibitedWords: instance.prohibitedWords,
|
prohibitedWords: instance.prohibitedWords,
|
||||||
|
prohibitedWordsForNameOfUser: instance.prohibitedWordsForNameOfUser,
|
||||||
preservedUsernames: instance.preservedUsernames,
|
preservedUsernames: instance.preservedUsernames,
|
||||||
hcaptchaSecretKey: instance.hcaptchaSecretKey,
|
hcaptchaSecretKey: instance.hcaptchaSecretKey,
|
||||||
mcaptchaSecretKey: instance.mcaptchaSecretKey,
|
mcaptchaSecretKey: instance.mcaptchaSecretKey,
|
||||||
|
|
|
@ -46,6 +46,11 @@ export const paramDef = {
|
||||||
type: 'string',
|
type: 'string',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
prohibitedWordsForNameOfUser: {
|
||||||
|
type: 'array', nullable: true, items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
},
|
||||||
themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' },
|
themeColor: { type: 'string', nullable: true, pattern: '^#[0-9a-fA-F]{6}$' },
|
||||||
mascotImageUrl: { type: 'string', nullable: true },
|
mascotImageUrl: { type: 'string', nullable: true },
|
||||||
bannerUrl: { type: 'string', nullable: true },
|
bannerUrl: { type: 'string', nullable: true },
|
||||||
|
@ -214,6 +219,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
if (Array.isArray(ps.prohibitedWords)) {
|
if (Array.isArray(ps.prohibitedWords)) {
|
||||||
set.prohibitedWords = ps.prohibitedWords.filter(Boolean);
|
set.prohibitedWords = ps.prohibitedWords.filter(Boolean);
|
||||||
}
|
}
|
||||||
|
if (Array.isArray(ps.prohibitedWordsForNameOfUser)) {
|
||||||
|
set.prohibitedWordsForNameOfUser = ps.prohibitedWordsForNameOfUser.filter(Boolean);
|
||||||
|
}
|
||||||
if (Array.isArray(ps.silencedHosts)) {
|
if (Array.isArray(ps.silencedHosts)) {
|
||||||
let lastValue = '';
|
let lastValue = '';
|
||||||
set.silencedHosts = ps.silencedHosts.sort().filter((h) => {
|
set.silencedHosts = ps.silencedHosts.sort().filter((h) => {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { JSDOM } from 'jsdom';
|
||||||
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
import { extractCustomEmojisFromMfm } from '@/misc/extract-custom-emojis-from-mfm.js';
|
||||||
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
import { extractHashtags } from '@/misc/extract-hashtags.js';
|
||||||
import * as Acct from '@/misc/acct.js';
|
import * as Acct from '@/misc/acct.js';
|
||||||
import type { UsersRepository, DriveFilesRepository, UserProfilesRepository, PagesRepository } from '@/models/_.js';
|
import type { UsersRepository, DriveFilesRepository, MiMeta, UserProfilesRepository, PagesRepository } from '@/models/_.js';
|
||||||
import type { MiLocalUser, MiUser } from '@/models/User.js';
|
import type { MiLocalUser, MiUser } from '@/models/User.js';
|
||||||
import { birthdaySchema, descriptionSchema, followedMessageSchema, locationSchema, nameSchema } from '@/models/User.js';
|
import { birthdaySchema, descriptionSchema, followedMessageSchema, locationSchema, nameSchema } from '@/models/User.js';
|
||||||
import type { MiUserProfile } from '@/models/UserProfile.js';
|
import type { MiUserProfile } from '@/models/UserProfile.js';
|
||||||
|
@ -22,6 +22,7 @@ import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
import { UserFollowingService } from '@/core/UserFollowingService.js';
|
||||||
import { AccountUpdateService } from '@/core/AccountUpdateService.js';
|
import { AccountUpdateService } from '@/core/AccountUpdateService.js';
|
||||||
|
import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { HashtagService } from '@/core/HashtagService.js';
|
import { HashtagService } from '@/core/HashtagService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { RolePolicies, RoleService } from '@/core/RoleService.js';
|
import { RolePolicies, RoleService } from '@/core/RoleService.js';
|
||||||
|
@ -114,6 +115,13 @@ export const meta = {
|
||||||
code: 'RESTRICTED_BY_ROLE',
|
code: 'RESTRICTED_BY_ROLE',
|
||||||
id: '8feff0ba-5ab5-585b-31f4-4df816663fad',
|
id: '8feff0ba-5ab5-585b-31f4-4df816663fad',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
nameContainsProhibitedWords: {
|
||||||
|
message: 'Your new name contains prohibited words.',
|
||||||
|
code: 'YOUR_NAME_CONTAINS_PROHIBITED_WORDS',
|
||||||
|
id: '0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191',
|
||||||
|
httpStatusCode: 422,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
res: {
|
res: {
|
||||||
|
@ -223,6 +231,9 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.config)
|
@Inject(DI.config)
|
||||||
private config: Config,
|
private config: Config,
|
||||||
|
|
||||||
|
@Inject(DI.meta)
|
||||||
|
private instanceMeta: MiMeta,
|
||||||
|
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
|
@ -247,6 +258,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private cacheService: CacheService,
|
private cacheService: CacheService,
|
||||||
private httpRequestService: HttpRequestService,
|
private httpRequestService: HttpRequestService,
|
||||||
private avatarDecorationService: AvatarDecorationService,
|
private avatarDecorationService: AvatarDecorationService,
|
||||||
|
private utilityService: UtilityService,
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, _user, token) => {
|
super(meta, paramDef, async (ps, _user, token) => {
|
||||||
const user = await this.usersRepository.findOneByOrFail({ id: _user.id }) as MiLocalUser;
|
const user = await this.usersRepository.findOneByOrFail({ id: _user.id }) as MiLocalUser;
|
||||||
|
@ -449,6 +461,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
const newFields = profileUpdates.fields === undefined ? profile.fields : profileUpdates.fields;
|
const newFields = profileUpdates.fields === undefined ? profile.fields : profileUpdates.fields;
|
||||||
|
|
||||||
if (newName != null) {
|
if (newName != null) {
|
||||||
|
let hasProhibitedWords = false;
|
||||||
|
if (!await this.roleService.isModerator(user)) {
|
||||||
|
hasProhibitedWords = this.utilityService.isKeyWordIncluded(newName, this.instanceMeta.prohibitedWordsForNameOfUser);
|
||||||
|
}
|
||||||
|
if (hasProhibitedWords) {
|
||||||
|
throw new ApiError(meta.errors.nameContainsProhibitedWords);
|
||||||
|
}
|
||||||
|
|
||||||
const tokens = mfm.parseSimple(newName);
|
const tokens = mfm.parseSimple(newName);
|
||||||
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens));
|
emojis = emojis.concat(extractCustomEmojisFromMfm(tokens));
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,11 @@ watch(name, () => {
|
||||||
// 空文字列をnullにしたいので??は使うな
|
// 空文字列をnullにしたいので??は使うな
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
name: name.value || null,
|
name: name.value || null,
|
||||||
|
}, undefined, {
|
||||||
|
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
|
||||||
|
title: i18n.ts.yourNameContainsProhibitedWords,
|
||||||
|
text: i18n.ts.yourNameContainsProhibitedWordsDescription,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { EventEmitter } from 'eventemitter3';
|
||||||
import * as Misskey from 'misskey-js';
|
import * as Misskey from 'misskey-js';
|
||||||
import type { ComponentProps as CP } from 'vue-component-type-helpers';
|
import type { ComponentProps as CP } from 'vue-component-type-helpers';
|
||||||
import type { Form, GetFormResultType } from '@/scripts/form.js';
|
import type { Form, GetFormResultType } from '@/scripts/form.js';
|
||||||
|
import type { MenuItem } from '@/types/menu.js';
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { defaultStore } from '@/store.js';
|
import { defaultStore } from '@/store.js';
|
||||||
import { i18n } from '@/i18n.js';
|
import { i18n } from '@/i18n.js';
|
||||||
|
@ -22,7 +23,6 @@ import MkPasswordDialog from '@/components/MkPasswordDialog.vue';
|
||||||
import MkEmojiPickerDialog from '@/components/MkEmojiPickerDialog.vue';
|
import MkEmojiPickerDialog from '@/components/MkEmojiPickerDialog.vue';
|
||||||
import MkPopupMenu from '@/components/MkPopupMenu.vue';
|
import MkPopupMenu from '@/components/MkPopupMenu.vue';
|
||||||
import MkContextMenu from '@/components/MkContextMenu.vue';
|
import MkContextMenu from '@/components/MkContextMenu.vue';
|
||||||
import type { MenuItem } from '@/types/menu.js';
|
|
||||||
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
import { copyToClipboard } from '@/scripts/copy-to-clipboard.js';
|
||||||
import { pleaseLogin } from '@/scripts/please-login.js';
|
import { pleaseLogin } from '@/scripts/please-login.js';
|
||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
||||||
|
@ -35,6 +35,7 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
|
||||||
endpoint: E,
|
endpoint: E,
|
||||||
data: P = {} as any,
|
data: P = {} as any,
|
||||||
token?: string | null | undefined,
|
token?: string | null | undefined,
|
||||||
|
customErrors?: Record<string, { title?: string; text: string; }>,
|
||||||
) => {
|
) => {
|
||||||
const promise = misskeyApi(endpoint, data, token);
|
const promise = misskeyApi(endpoint, data, token);
|
||||||
promiseDialog(promise, null, async (err) => {
|
promiseDialog(promise, null, async (err) => {
|
||||||
|
@ -77,6 +78,9 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
|
||||||
} else if (err.message.startsWith('Unexpected token')) {
|
} else if (err.message.startsWith('Unexpected token')) {
|
||||||
title = i18n.ts.gotInvalidResponseError;
|
title = i18n.ts.gotInvalidResponseError;
|
||||||
text = i18n.ts.gotInvalidResponseErrorDescription;
|
text = i18n.ts.gotInvalidResponseErrorDescription;
|
||||||
|
} else if (customErrors && customErrors[err.id] != null) {
|
||||||
|
title = customErrors[err.id].title;
|
||||||
|
text = customErrors[err.id].text;
|
||||||
}
|
}
|
||||||
alert({
|
alert({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
@ -86,7 +90,7 @@ export const apiWithDialog = (<E extends keyof Misskey.Endpoints = keyof Misskey
|
||||||
});
|
});
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
}) as typeof misskeyApi;
|
});
|
||||||
|
|
||||||
export function promiseDialog<T extends Promise<any>>(
|
export function promiseDialog<T extends Promise<any>>(
|
||||||
promise: T,
|
promise: T,
|
||||||
|
|
|
@ -57,6 +57,18 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</MkFolder>
|
</MkFolder>
|
||||||
|
|
||||||
|
<MkFolder>
|
||||||
|
<template #icon><i class="ti ti-user-x"></i></template>
|
||||||
|
<template #label>{{ i18n.ts.prohibitedWordsForNameOfUser }}</template>
|
||||||
|
|
||||||
|
<div class="_gaps">
|
||||||
|
<MkTextarea v-model="prohibitedWordsForNameOfUser">
|
||||||
|
<template #caption>{{ i18n.ts.prohibitedWordsForNameOfUserDescription }}<br>{{ i18n.ts.prohibitedWordsDescription2 }}</template>
|
||||||
|
</MkTextarea>
|
||||||
|
<MkButton primary @click="save_prohibitedWordsForNameOfUser">{{ i18n.ts.save }}</MkButton>
|
||||||
|
</div>
|
||||||
|
</MkFolder>
|
||||||
|
|
||||||
<MkFolder>
|
<MkFolder>
|
||||||
<template #icon><i class="ti ti-eye-off"></i></template>
|
<template #icon><i class="ti ti-eye-off"></i></template>
|
||||||
<template #label>{{ i18n.ts.hiddenTags }}</template>
|
<template #label>{{ i18n.ts.hiddenTags }}</template>
|
||||||
|
@ -131,6 +143,7 @@ const enableRegistration = ref<boolean>(false);
|
||||||
const emailRequiredForSignup = ref<boolean>(false);
|
const emailRequiredForSignup = ref<boolean>(false);
|
||||||
const sensitiveWords = ref<string>('');
|
const sensitiveWords = ref<string>('');
|
||||||
const prohibitedWords = ref<string>('');
|
const prohibitedWords = ref<string>('');
|
||||||
|
const prohibitedWordsForNameOfUser = ref<string>('');
|
||||||
const hiddenTags = ref<string>('');
|
const hiddenTags = ref<string>('');
|
||||||
const preservedUsernames = ref<string>('');
|
const preservedUsernames = ref<string>('');
|
||||||
const blockedHosts = ref<string>('');
|
const blockedHosts = ref<string>('');
|
||||||
|
@ -143,10 +156,11 @@ async function init() {
|
||||||
emailRequiredForSignup.value = meta.emailRequiredForSignup;
|
emailRequiredForSignup.value = meta.emailRequiredForSignup;
|
||||||
sensitiveWords.value = meta.sensitiveWords.join('\n');
|
sensitiveWords.value = meta.sensitiveWords.join('\n');
|
||||||
prohibitedWords.value = meta.prohibitedWords.join('\n');
|
prohibitedWords.value = meta.prohibitedWords.join('\n');
|
||||||
|
prohibitedWordsForNameOfUser.value = meta.prohibitedWordsForNameOfUser.join('\n');
|
||||||
hiddenTags.value = meta.hiddenTags.join('\n');
|
hiddenTags.value = meta.hiddenTags.join('\n');
|
||||||
preservedUsernames.value = meta.preservedUsernames.join('\n');
|
preservedUsernames.value = meta.preservedUsernames.join('\n');
|
||||||
blockedHosts.value = meta.blockedHosts.join('\n');
|
blockedHosts.value = meta.blockedHosts.join('\n');
|
||||||
silencedHosts.value = meta.silencedHosts.join('\n');
|
silencedHosts.value = meta.silencedHosts?.join('\n') ?? '';
|
||||||
mediaSilencedHosts.value = meta.mediaSilencedHosts.join('\n');
|
mediaSilencedHosts.value = meta.mediaSilencedHosts.join('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +204,14 @@ function save_prohibitedWords() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function save_prohibitedWordsForNameOfUser() {
|
||||||
|
os.apiWithDialog('admin/update-meta', {
|
||||||
|
prohibitedWordsForNameOfUser: prohibitedWordsForNameOfUser.value.split('\n'),
|
||||||
|
}).then(() => {
|
||||||
|
fetchInstance(true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function save_hiddenTags() {
|
function save_hiddenTags() {
|
||||||
os.apiWithDialog('admin/update-meta', {
|
os.apiWithDialog('admin/update-meta', {
|
||||||
hiddenTags: hiddenTags.value.split('\n'),
|
hiddenTags: hiddenTags.value.split('\n'),
|
||||||
|
|
|
@ -142,13 +142,17 @@ const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.d
|
||||||
|
|
||||||
const reactionAcceptance = computed(defaultStore.makeGetterSetter('reactionAcceptance'));
|
const reactionAcceptance = computed(defaultStore.makeGetterSetter('reactionAcceptance'));
|
||||||
|
|
||||||
|
function assertVaildLang(lang: string | null): lang is keyof typeof langmap {
|
||||||
|
return lang != null && lang in langmap;
|
||||||
|
}
|
||||||
|
|
||||||
const profile = reactive({
|
const profile = reactive({
|
||||||
name: $i.name,
|
name: $i.name,
|
||||||
description: $i.description,
|
description: $i.description,
|
||||||
followedMessage: $i.followedMessage,
|
followedMessage: $i.followedMessage,
|
||||||
location: $i.location,
|
location: $i.location,
|
||||||
birthday: $i.birthday,
|
birthday: $i.birthday,
|
||||||
lang: $i.lang,
|
lang: assertVaildLang($i.lang) ? $i.lang : null,
|
||||||
isBot: $i.isBot ?? false,
|
isBot: $i.isBot ?? false,
|
||||||
isCat: $i.isCat ?? false,
|
isCat: $i.isCat ?? false,
|
||||||
});
|
});
|
||||||
|
@ -202,6 +206,11 @@ function save() {
|
||||||
lang: profile.lang || null,
|
lang: profile.lang || null,
|
||||||
isBot: !!profile.isBot,
|
isBot: !!profile.isBot,
|
||||||
isCat: !!profile.isCat,
|
isCat: !!profile.isCat,
|
||||||
|
}, undefined, {
|
||||||
|
'0b3f9f6a-2f4d-4b1f-9fb4-49d3a2fd7191': {
|
||||||
|
title: i18n.ts.yourNameContainsProhibitedWords,
|
||||||
|
text: i18n.ts.yourNameContainsProhibitedWordsDescription,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
globalEvents.emit('requestClearPageCache');
|
globalEvents.emit('requestClearPageCache');
|
||||||
claimAchievement('profileFilled');
|
claimAchievement('profileFilled');
|
||||||
|
|
|
@ -245,13 +245,10 @@ export function getNoteMenu(props: {
|
||||||
function togglePin(pin: boolean): void {
|
function togglePin(pin: boolean): void {
|
||||||
os.apiWithDialog(pin ? 'i/pin' : 'i/unpin', {
|
os.apiWithDialog(pin ? 'i/pin' : 'i/unpin', {
|
||||||
noteId: appearNote.id,
|
noteId: appearNote.id,
|
||||||
}, undefined, null, res => {
|
}, undefined, {
|
||||||
if (res.id === '72dab508-c64d-498f-8740-a8eec1ba385a') {
|
'72dab508-c64d-498f-8740-a8eec1ba385a': {
|
||||||
os.alert({
|
text: i18n.ts.pinLimitExceeded,
|
||||||
type: 'error',
|
},
|
||||||
text: i18n.ts.pinLimitExceeded,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5124,6 +5124,7 @@ export type operations = {
|
||||||
blockedHosts: string[];
|
blockedHosts: string[];
|
||||||
sensitiveWords: string[];
|
sensitiveWords: string[];
|
||||||
prohibitedWords: string[];
|
prohibitedWords: string[];
|
||||||
|
prohibitedWordsForNameOfUser: string[];
|
||||||
bannedEmailDomains?: string[];
|
bannedEmailDomains?: string[];
|
||||||
preservedUsernames: string[];
|
preservedUsernames: string[];
|
||||||
hcaptchaSecretKey: string | null;
|
hcaptchaSecretKey: string | null;
|
||||||
|
@ -9461,6 +9462,7 @@ export type operations = {
|
||||||
blockedHosts?: string[] | null;
|
blockedHosts?: string[] | null;
|
||||||
sensitiveWords?: string[] | null;
|
sensitiveWords?: string[] | null;
|
||||||
prohibitedWords?: string[] | null;
|
prohibitedWords?: string[] | null;
|
||||||
|
prohibitedWordsForNameOfUser?: string[] | null;
|
||||||
themeColor?: string | null;
|
themeColor?: string | null;
|
||||||
mascotImageUrl?: string | null;
|
mascotImageUrl?: string | null;
|
||||||
bannerUrl?: string | null;
|
bannerUrl?: string | null;
|
||||||
|
|
Loading…
Reference in New Issue