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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -103,7 +103,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
if (
this.serverSettings.permanentFollowedUsers.includes(mutee.id) &&
this.serverSettings.forciblyFollowedUsers.includes(mutee.id) &&
!await this.roleService.isModerator(muter)
) {
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 #caption>{{ i18n.ts.defaultFollowedUsersDescription }}</template>
</MkTextarea>
<MkTextarea v-model="permanentFollowedUsers">
<template #label>{{ i18n.ts.permanentFollowedUsers }}</template>
<template #caption>{{ i18n.ts.permanentFollowedUsersDescription }}</template>
<MkTextarea v-model="forciblyFollowedUsers">
<template #label>{{ i18n.ts.forciblyFollowedUsers }}</template>
<template #caption>{{ i18n.ts.forciblyFollowedUsersDescription }}</template>
</MkTextarea>
<MkButton primary @click="save_defaultUsers">{{ i18n.ts.save }}</MkButton>
</div>
@ -164,7 +164,7 @@ const prohibitedWordsForNameOfUser = ref<string>('');
const hiddenTags = ref<string>('');
const preservedUsernames = ref<string>('');
const defaultFollowedUsers = ref<string>('');
const permanentFollowedUsers = ref<string>('');
const forciblyFollowedUsers = ref<string>('');
const blockedHosts = ref<string>('');
const silencedHosts = ref<string>('');
const mediaSilencedHosts = ref<string>('');
@ -179,7 +179,7 @@ async function init() {
hiddenTags.value = meta.hiddenTags.join('\n');
preservedUsernames.value = meta.preservedUsernames.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');
silencedHosts.value = meta.silencedHosts?.join('\n') ?? '';
mediaSilencedHosts.value = meta.mediaSilencedHosts.join('\n');
@ -212,7 +212,7 @@ function save_preservedUsernames() {
function save_defaultUsers() {
os.apiWithDialog('admin/update-meta', {
defaultFollowedUsers: defaultFollowedUsers.value.split('\n'),
permanentFollowedUsers: permanentFollowedUsers.value.split('\n'),
forciblyFollowedUsers: forciblyFollowedUsers.value.split('\n'),
}, undefined, {
'bcf088ec-fec5-42d0-8b9e-16d3b4797a4d': {
text: i18n.ts.defaultFollowedUsersDuplicated,

View File

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