`forciblyFollowedUsers` に変更

This commit is contained in:
kakkokari-gtyih 2024-10-18 16:47:06 +09:00
parent 4a21edacde
commit 52ee21b2ee
12 changed files with 27 additions and 27 deletions

4
locales/index.d.ts vendored
View File

@ -5201,11 +5201,11 @@ export interface Locale extends ILocale {
/** /**
* *
*/ */
"permanentFollowedUsers": string; "forciblyFollowedUsers": string;
/** /**
* *
*/ */
"permanentFollowedUsersDescription": string; "forciblyFollowedUsersDescription": string;
/** /**
* *
*/ */

View File

@ -1295,8 +1295,8 @@ yourNameContainsProhibitedWords: "変更しようとした名前に禁止され
yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。" yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。"
defaultFollowedUsers: "デフォルトでフォローするユーザー" defaultFollowedUsers: "デフォルトでフォローするユーザー"
defaultFollowedUsersDescription: "今後アカウントが作成された際に自動でフォローされるユーザー(解除可能)を改行区切りで指定します。" defaultFollowedUsersDescription: "今後アカウントが作成された際に自動でフォローされるユーザー(解除可能)を改行区切りで指定します。"
permanentFollowedUsers: "交流を断てないユーザー" forciblyFollowedUsers: "交流を断てないユーザー"
permanentFollowedUsersDescription: "今後アカウントが作成された際には自動でフォローされ、フォローの解除やミュート・ブロックができないユーザーを改行区切りで指定します。" forciblyFollowedUsersDescription: "今後アカウントが作成された際には自動でフォローされ、フォローの解除やミュート・ブロックができないユーザーを改行区切りで指定します。"
defaultFollowedUsersDuplicated: "「デフォルトでフォローするユーザー」と「交流を絶てないユーザー」が重複しています。" defaultFollowedUsersDuplicated: "「デフォルトでフォローするユーザー」と「交流を絶てないユーザー」が重複しています。"
unfollowThisUserIsProhibited: "サーバー管理者はこのユーザーをフォロー解除することを禁止しています。" unfollowThisUserIsProhibited: "サーバー管理者はこのユーザーをフォロー解除することを禁止しています。"
blockThisUserIsProhibited: "サーバー管理者はこのユーザーをブロックすることを禁止しています。" blockThisUserIsProhibited: "サーバー管理者はこのユーザーをブロックすることを禁止しています。"

View File

@ -157,11 +157,11 @@ export class SignupService {
//#region Default following //#region Default following
if ( if (
!isTheFirstUser && !isTheFirstUser &&
(this.meta.defaultFollowedUsers.length > 0 || this.meta.permanentFollowedUsers.length > 0) (this.meta.defaultFollowedUsers.length > 0 || this.meta.forciblyFollowedUsers.length > 0)
) { ) {
const userIdsToFollow = [ const userIdsToFollow = [
...this.meta.defaultFollowedUsers, ...this.meta.defaultFollowedUsers,
...this.meta.permanentFollowedUsers, ...this.meta.forciblyFollowedUsers,
]; ];
await Promise.allSettled(userIdsToFollow.map(async userId => { await Promise.allSettled(userIdsToFollow.map(async userId => {

View File

@ -75,7 +75,7 @@ export class MiMeta {
@Column('varchar', { @Column('varchar', {
length: 1024, array: true, default: '{}', length: 1024, array: true, default: '{}',
}) })
public permanentFollowedUsers: string[]; public forciblyFollowedUsers: string[];
@Column('varchar', { @Column('varchar', {
length: 1024, array: true, default: '{}', length: 1024, array: true, default: '{}',

View File

@ -156,7 +156,7 @@ export const meta = {
type: 'string', type: 'string',
}, },
}, },
permanentFollowedUsers: { forciblyFollowedUsers: {
type: 'array', type: 'array',
optional: false, nullable: false, optional: false, nullable: false,
items: { items: {
@ -606,7 +606,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles, cacheRemoteSensitiveFiles: instance.cacheRemoteSensitiveFiles,
pinnedUsers: instance.pinnedUsers, pinnedUsers: instance.pinnedUsers,
defaultFollowedUsers: instance.defaultFollowedUsers, defaultFollowedUsers: instance.defaultFollowedUsers,
permanentFollowedUsers: instance.permanentFollowedUsers, forciblyFollowedUsers: instance.forciblyFollowedUsers,
hiddenTags: instance.hiddenTags, hiddenTags: instance.hiddenTags,
blockedHosts: instance.blockedHosts, blockedHosts: instance.blockedHosts,
silencedHosts: instance.silencedHosts, silencedHosts: instance.silencedHosts,

View File

@ -20,7 +20,7 @@ export const meta = {
errors: { errors: {
followedUserDuplicated: { followedUserDuplicated: {
message: 'Some items in "defaultFollowedUsers" and "permanentFollowedUsers" are duplicated.', message: 'Some items in "defaultFollowedUsers" and "forciblyFollowedUsers" are duplicated.',
code: 'FOLLOWED_USER_DUPLICATED', code: 'FOLLOWED_USER_DUPLICATED',
id: 'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d', id: 'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d',
}, },
@ -41,7 +41,7 @@ export const paramDef = {
type: 'string', type: 'string',
}, },
}, },
permanentFollowedUsers: { forciblyFollowedUsers: {
type: 'array', nullable: true, items: { type: 'array', nullable: true, items: {
type: 'string', type: 'string',
}, },
@ -230,19 +230,19 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if (Array.isArray(ps.defaultFollowedUsers)) { if (Array.isArray(ps.defaultFollowedUsers)) {
if (ps.defaultFollowedUsers.some(x => this.serverSettings.permanentFollowedUsers.includes(x) || ps.permanentFollowedUsers?.includes(x))) { if (ps.defaultFollowedUsers.some(x => this.serverSettings.forciblyFollowedUsers.includes(x) || ps.forciblyFollowedUsers?.includes(x))) {
throw new ApiError(meta.errors.followedUserDuplicated); throw new ApiError(meta.errors.followedUserDuplicated);
} }
set.defaultFollowedUsers = ps.defaultFollowedUsers.filter(Boolean); set.defaultFollowedUsers = ps.defaultFollowedUsers.filter(Boolean);
} }
if (Array.isArray(ps.permanentFollowedUsers)) { if (Array.isArray(ps.forciblyFollowedUsers)) {
if (ps.permanentFollowedUsers.some(x => this.serverSettings.defaultFollowedUsers.includes(x) || ps.defaultFollowedUsers?.includes(x))) { if (ps.forciblyFollowedUsers.some(x => this.serverSettings.defaultFollowedUsers.includes(x) || ps.defaultFollowedUsers?.includes(x))) {
throw new ApiError(meta.errors.followedUserDuplicated); throw new ApiError(meta.errors.followedUserDuplicated);
} }
set.permanentFollowedUsers = ps.permanentFollowedUsers.filter(Boolean); set.forciblyFollowedUsers = ps.forciblyFollowedUsers.filter(Boolean);
} }
if (Array.isArray(ps.hiddenTags)) { if (Array.isArray(ps.hiddenTags)) {

View File

@ -113,7 +113,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if ( if (
this.serverSettings.permanentFollowedUsers.includes(blockee.id) && this.serverSettings.forciblyFollowedUsers.includes(blockee.id) &&
!await this.roleService.isModerator(blocker) !await this.roleService.isModerator(blocker)
) { ) {
throw new ApiError(meta.errors.cannotBlockDueToServerPolicy); throw new ApiError(meta.errors.cannotBlockDueToServerPolicy);

View File

@ -110,7 +110,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if ( if (
this.serverSettings.permanentFollowedUsers.includes(followee.id) && this.serverSettings.forciblyFollowedUsers.includes(followee.id) &&
!await this.roleService.isModerator(follower) !await this.roleService.isModerator(follower)
) { ) {
throw new ApiError(meta.errors.cannotUnfollowDueToServerPolicy); throw new ApiError(meta.errors.cannotUnfollowDueToServerPolicy);

View File

@ -108,7 +108,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if ( if (
this.serverSettings.permanentFollowedUsers.includes(mutee.id) && this.serverSettings.forciblyFollowedUsers.includes(mutee.id) &&
!await this.roleService.isModerator(muter) !await this.roleService.isModerator(muter)
) { ) {
throw new ApiError(meta.errors.cannotMuteDueToServerPolicy); throw new ApiError(meta.errors.cannotMuteDueToServerPolicy);

View File

@ -103,7 +103,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} }
if ( if (
this.serverSettings.permanentFollowedUsers.includes(mutee.id) && this.serverSettings.forciblyFollowedUsers.includes(mutee.id) &&
!await this.roleService.isModerator(muter) !await this.roleService.isModerator(muter)
) { ) {
throw new ApiError(meta.errors.cannotMuteDueToServerPolicy); throw new ApiError(meta.errors.cannotMuteDueToServerPolicy);

View File

@ -42,9 +42,9 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #label>{{ i18n.ts.defaultFollowedUsers }}</template> <template #label>{{ i18n.ts.defaultFollowedUsers }}</template>
<template #caption>{{ i18n.ts.defaultFollowedUsersDescription }}</template> <template #caption>{{ i18n.ts.defaultFollowedUsersDescription }}</template>
</MkTextarea> </MkTextarea>
<MkTextarea v-model="permanentFollowedUsers"> <MkTextarea v-model="forciblyFollowedUsers">
<template #label>{{ i18n.ts.permanentFollowedUsers }}</template> <template #label>{{ i18n.ts.forciblyFollowedUsers }}</template>
<template #caption>{{ i18n.ts.permanentFollowedUsersDescription }}</template> <template #caption>{{ i18n.ts.forciblyFollowedUsersDescription }}</template>
</MkTextarea> </MkTextarea>
<MkButton primary @click="save_defaultUsers">{{ i18n.ts.save }}</MkButton> <MkButton primary @click="save_defaultUsers">{{ i18n.ts.save }}</MkButton>
</div> </div>
@ -164,7 +164,7 @@ const prohibitedWordsForNameOfUser = ref<string>('');
const hiddenTags = ref<string>(''); const hiddenTags = ref<string>('');
const preservedUsernames = ref<string>(''); const preservedUsernames = ref<string>('');
const defaultFollowedUsers = ref<string>(''); const defaultFollowedUsers = ref<string>('');
const permanentFollowedUsers = ref<string>(''); const forciblyFollowedUsers = ref<string>('');
const blockedHosts = ref<string>(''); const blockedHosts = ref<string>('');
const silencedHosts = ref<string>(''); const silencedHosts = ref<string>('');
const mediaSilencedHosts = ref<string>(''); const mediaSilencedHosts = ref<string>('');
@ -179,7 +179,7 @@ async function init() {
hiddenTags.value = meta.hiddenTags.join('\n'); hiddenTags.value = meta.hiddenTags.join('\n');
preservedUsernames.value = meta.preservedUsernames.join('\n'); preservedUsernames.value = meta.preservedUsernames.join('\n');
defaultFollowedUsers.value = meta.defaultFollowedUsers.join('\n'); defaultFollowedUsers.value = meta.defaultFollowedUsers.join('\n');
permanentFollowedUsers.value = meta.permanentFollowedUsers.join('\n'); forciblyFollowedUsers.value = meta.forciblyFollowedUsers.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');
@ -212,7 +212,7 @@ function save_preservedUsernames() {
function save_defaultUsers() { function save_defaultUsers() {
os.apiWithDialog('admin/update-meta', { os.apiWithDialog('admin/update-meta', {
defaultFollowedUsers: defaultFollowedUsers.value.split('\n'), defaultFollowedUsers: defaultFollowedUsers.value.split('\n'),
permanentFollowedUsers: permanentFollowedUsers.value.split('\n'), forciblyFollowedUsers: forciblyFollowedUsers.value.split('\n'),
}, undefined, { }, undefined, {
'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d': { 'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d': {
text: i18n.ts.defaultFollowedUsersDuplicated, text: i18n.ts.defaultFollowedUsersDuplicated,

View File

@ -5121,7 +5121,7 @@ export type operations = {
mediaSilencedHosts: string[]; mediaSilencedHosts: string[];
pinnedUsers: string[]; pinnedUsers: string[];
defaultFollowedUsers: string[]; defaultFollowedUsers: string[];
permanentFollowedUsers: string[]; forciblyFollowedUsers: string[];
hiddenTags: string[]; hiddenTags: string[];
blockedHosts: string[]; blockedHosts: string[];
sensitiveWords: string[]; sensitiveWords: string[];
@ -9462,7 +9462,7 @@ export type operations = {
disableRegistration?: boolean | null; disableRegistration?: boolean | null;
pinnedUsers?: string[] | null; pinnedUsers?: string[] | null;
defaultFollowedUsers?: string[] | null; defaultFollowedUsers?: string[] | null;
permanentFollowedUsers?: string[] | null; forciblyFollowedUsers?: string[] | null;
hiddenTags?: string[] | null; hiddenTags?: string[] | null;
blockedHosts?: string[] | null; blockedHosts?: string[] | null;
sensitiveWords?: string[] | null; sensitiveWords?: string[] | null;