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

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);