mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 15:15:12 +00:00
suspend周りの改修 (#14409)
* enhance(backend): 凍結されたアカウントのフォローリクエストを表示しないように * Update CHANGELOG.md * wip * Update gen-spec.ts * Update packages/backend/src/server/api/endpoints/admin/suspend-user.ts Co-authored-by: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> * owa- * revert misskey-js related changes (#14414) --------- Co-authored-by: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> Co-authored-by: anatawa12 <anatawa12@icloud.com>
This commit is contained in:
parent
bfaf938609
commit
ef950a345b
13 changed files with 166 additions and 98 deletions
|
@ -1,8 +1,9 @@
|
||||||
## 2024.8.0
|
## 2024.8.0
|
||||||
|
|
||||||
### General
|
### General
|
||||||
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
|
||||||
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
- Enhance: モデレーターはすべてのユーザーのフォロー・フォロワーの一覧を見られるように
|
||||||
|
- Enhance: アカウントの削除のモデレーションログを残すように
|
||||||
|
- Fix: リモートユーザのフォロー・フォロワーの一覧が非公開設定の場合も表示できてしまう問題を修正
|
||||||
|
|
||||||
### Client
|
### Client
|
||||||
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
- Enhance: 「自分のPlay」ページにおいてPlayが非公開かどうかが一目でわかるように
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
- Fix: ユーザーのモデレーションページにおいてユーザー名にドットが入っているとシステムアカウントとして表示されてしまう問題を修正
|
- Fix: ユーザーのモデレーションページにおいてユーザー名にドットが入っているとシステムアカウントとして表示されてしまう問題を修正
|
||||||
|
|
||||||
### Server
|
### Server
|
||||||
|
- Enhance: 凍結されたアカウントのフォローリクエストを表示しないように
|
||||||
- Fix: WSの`readAllNotifications` メッセージが `body` を持たない場合に動作しない問題 #14374
|
- Fix: WSの`readAllNotifications` メッセージが `body` を持たない場合に動作しない問題 #14374
|
||||||
- 通知ページや通知カラム(デッキ)を開いている状態において、新たに発生した通知が既読されない問題が修正されます。
|
- 通知ページや通知カラム(デッキ)を開いている状態において、新たに発生した通知が既読されない問題が修正されます。
|
||||||
- これにより、プッシュ通知が有効な同条件下の環境において、プッシュ通知が常に発生してしまう問題も修正されます。
|
- これにより、プッシュ通知が有効な同条件下の環境において、プッシュ通知が常に発生してしまう問題も修正されます。
|
||||||
|
|
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -9683,6 +9683,10 @@ export interface Locale extends ILocale {
|
||||||
* 通報の通知先を削除
|
* 通報の通知先を削除
|
||||||
*/
|
*/
|
||||||
"deleteAbuseReportNotificationRecipient": string;
|
"deleteAbuseReportNotificationRecipient": string;
|
||||||
|
/**
|
||||||
|
* アカウントを削除
|
||||||
|
*/
|
||||||
|
"deleteAccount": string;
|
||||||
};
|
};
|
||||||
"_fileViewer": {
|
"_fileViewer": {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2568,6 +2568,7 @@ _moderationLogTypes:
|
||||||
createAbuseReportNotificationRecipient: "通報の通知先を作成"
|
createAbuseReportNotificationRecipient: "通報の通知先を作成"
|
||||||
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
updateAbuseReportNotificationRecipient: "通報の通知先を更新"
|
||||||
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
deleteAbuseReportNotificationRecipient: "通報の通知先を削除"
|
||||||
|
deleteAccount: "アカウントを削除"
|
||||||
|
|
||||||
_fileViewer:
|
_fileViewer:
|
||||||
title: "ファイルの詳細"
|
title: "ファイルの詳細"
|
||||||
|
|
|
@ -4,12 +4,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import type { UsersRepository } from '@/models/_.js';
|
import { Not, IsNull } from 'typeorm';
|
||||||
|
import type { FollowingsRepository, MiUser, UsersRepository } from '@/models/_.js';
|
||||||
import { QueueService } from '@/core/QueueService.js';
|
import { QueueService } from '@/core/QueueService.js';
|
||||||
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
|
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class DeleteAccountService {
|
export class DeleteAccountService {
|
||||||
|
@ -17,9 +20,14 @@ export class DeleteAccountService {
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
private userSuspendService: UserSuspendService,
|
@Inject(DI.followingsRepository)
|
||||||
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
|
private userEntityService: UserEntityService,
|
||||||
|
private apRendererService: ApRendererService,
|
||||||
private queueService: QueueService,
|
private queueService: QueueService,
|
||||||
private globalEventService: GlobalEventService,
|
private globalEventService: GlobalEventService,
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,16 +35,52 @@ export class DeleteAccountService {
|
||||||
public async deleteAccount(user: {
|
public async deleteAccount(user: {
|
||||||
id: string;
|
id: string;
|
||||||
host: string | null;
|
host: string | null;
|
||||||
}): Promise<void> {
|
}, moderator?: MiUser): Promise<void> {
|
||||||
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });
|
const _user = await this.usersRepository.findOneByOrFail({ id: user.id });
|
||||||
if (_user.isRoot) throw new Error('cannot delete a root account');
|
if (_user.isRoot) throw new Error('cannot delete a root account');
|
||||||
|
|
||||||
|
if (moderator != null) {
|
||||||
|
this.moderationLogService.log(moderator, 'deleteAccount', {
|
||||||
|
userId: user.id,
|
||||||
|
userUsername: _user.username,
|
||||||
|
userHost: user.host,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// 物理削除する前にDelete activityを送信する
|
// 物理削除する前にDelete activityを送信する
|
||||||
await this.userSuspendService.doPostSuspend(user).catch(e => {});
|
if (this.userEntityService.isLocalUser(user)) {
|
||||||
|
// 知り得る全SharedInboxにDelete配信
|
||||||
|
const content = this.apRendererService.addContext(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user));
|
||||||
|
|
||||||
|
const queue: string[] = [];
|
||||||
|
|
||||||
|
const followings = await this.followingsRepository.find({
|
||||||
|
where: [
|
||||||
|
{ followerSharedInbox: Not(IsNull()) },
|
||||||
|
{ followeeSharedInbox: Not(IsNull()) },
|
||||||
|
],
|
||||||
|
select: ['followerSharedInbox', 'followeeSharedInbox'],
|
||||||
|
});
|
||||||
|
|
||||||
|
const inboxes = followings.map(x => x.followerSharedInbox ?? x.followeeSharedInbox);
|
||||||
|
|
||||||
|
for (const inbox of inboxes) {
|
||||||
|
if (inbox != null && !queue.includes(inbox)) queue.push(inbox);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const inbox of queue) {
|
||||||
|
this.queueService.deliver(user, content, inbox, true);
|
||||||
|
}
|
||||||
|
|
||||||
this.queueService.createDeleteAccountJob(user, {
|
this.queueService.createDeleteAccountJob(user, {
|
||||||
soft: false,
|
soft: false,
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する
|
||||||
|
this.queueService.createDeleteAccountJob(user, {
|
||||||
|
soft: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
await this.usersRepository.update(user.id, {
|
await this.usersRepository.update(user.id, {
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Not, IsNull } from 'typeorm';
|
import { Not, IsNull } from 'typeorm';
|
||||||
import type { FollowingsRepository } from '@/models/_.js';
|
import type { FollowingsRepository, FollowRequestsRepository, UsersRepository } from '@/models/_.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
import type { MiUser } from '@/models/User.js';
|
||||||
import { QueueService } from '@/core/QueueService.js';
|
import { QueueService } from '@/core/QueueService.js';
|
||||||
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
import { GlobalEventService } from '@/core/GlobalEventService.js';
|
||||||
|
@ -13,24 +13,75 @@ import { DI } from '@/di-symbols.js';
|
||||||
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
import { ApRendererService } from '@/core/activitypub/ApRendererService.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
import { bindThis } from '@/decorators.js';
|
||||||
|
import { RelationshipJobData } from '@/queue/types.js';
|
||||||
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserSuspendService {
|
export class UserSuspendService {
|
||||||
constructor(
|
constructor(
|
||||||
|
@Inject(DI.usersRepository)
|
||||||
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
@Inject(DI.followingsRepository)
|
@Inject(DI.followingsRepository)
|
||||||
private followingsRepository: FollowingsRepository,
|
private followingsRepository: FollowingsRepository,
|
||||||
|
|
||||||
|
@Inject(DI.followRequestsRepository)
|
||||||
|
private followRequestsRepository: FollowRequestsRepository,
|
||||||
|
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private queueService: QueueService,
|
private queueService: QueueService,
|
||||||
private globalEventService: GlobalEventService,
|
private globalEventService: GlobalEventService,
|
||||||
private apRendererService: ApRendererService,
|
private apRendererService: ApRendererService,
|
||||||
|
private moderationLogService: ModerationLogService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async doPostSuspend(user: { id: MiUser['id']; host: MiUser['host'] }): Promise<void> {
|
public async suspend(user: MiUser, moderator: MiUser): Promise<void> {
|
||||||
|
await this.usersRepository.update(user.id, {
|
||||||
|
isSuspended: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.moderationLogService.log(moderator, 'suspend', {
|
||||||
|
userId: user.id,
|
||||||
|
userUsername: user.username,
|
||||||
|
userHost: user.host,
|
||||||
|
});
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await this.postSuspend(user).catch(e => {});
|
||||||
|
await this.unFollowAll(user).catch(e => {});
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
public async unsuspend(user: MiUser, moderator: MiUser): Promise<void> {
|
||||||
|
await this.usersRepository.update(user.id, {
|
||||||
|
isSuspended: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
this.moderationLogService.log(moderator, 'unsuspend', {
|
||||||
|
userId: user.id,
|
||||||
|
userUsername: user.username,
|
||||||
|
userHost: user.host,
|
||||||
|
});
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await this.postUnsuspend(user).catch(e => {});
|
||||||
|
})();
|
||||||
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
private async postSuspend(user: { id: MiUser['id']; host: MiUser['host'] }): Promise<void> {
|
||||||
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: true });
|
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: true });
|
||||||
|
|
||||||
|
this.followRequestsRepository.delete({
|
||||||
|
followeeId: user.id,
|
||||||
|
});
|
||||||
|
this.followRequestsRepository.delete({
|
||||||
|
followerId: user.id,
|
||||||
|
});
|
||||||
|
|
||||||
if (this.userEntityService.isLocalUser(user)) {
|
if (this.userEntityService.isLocalUser(user)) {
|
||||||
// 知り得る全SharedInboxにDelete配信
|
// 知り得る全SharedInboxにDelete配信
|
||||||
const content = this.apRendererService.addContext(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user));
|
const content = this.apRendererService.addContext(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user));
|
||||||
|
@ -58,7 +109,7 @@ export class UserSuspendService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async doPostUnsuspend(user: MiUser): Promise<void> {
|
private async postUnsuspend(user: MiUser): Promise<void> {
|
||||||
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: false });
|
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: false });
|
||||||
|
|
||||||
if (this.userEntityService.isLocalUser(user)) {
|
if (this.userEntityService.isLocalUser(user)) {
|
||||||
|
@ -86,4 +137,26 @@ export class UserSuspendService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bindThis
|
||||||
|
private async unFollowAll(follower: MiUser) {
|
||||||
|
const followings = await this.followingsRepository.find({
|
||||||
|
where: {
|
||||||
|
followerId: follower.id,
|
||||||
|
followeeId: Not(IsNull()),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const jobs: RelationshipJobData[] = [];
|
||||||
|
for (const following of followings) {
|
||||||
|
if (following.followeeId && following.followerId) {
|
||||||
|
jobs.push({
|
||||||
|
from: { id: following.followerId },
|
||||||
|
to: { id: following.followeeId },
|
||||||
|
silent: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.queueService.createUnfollowJob(jobs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,9 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { UsersRepository } from '@/models/_.js';
|
import type { UsersRepository } from '@/models/_.js';
|
||||||
import { QueueService } from '@/core/QueueService.js';
|
import { QueueService } from '@/core/QueueService.js';
|
||||||
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
||||||
|
import { DeleteAccountService } from '@/core/DeleteAccountService.js';
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -33,9 +33,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
private userEntityService: UserEntityService,
|
private deleteAccoountService: DeleteAccountService,
|
||||||
private queueService: QueueService,
|
|
||||||
private userSuspendService: UserSuspendService,
|
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||||
|
@ -48,22 +46,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new Error('cannot delete a root account');
|
throw new Error('cannot delete a root account');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.userEntityService.isLocalUser(user)) {
|
await this.deleteAccoountService.deleteAccount(user);
|
||||||
// 物理削除する前にDelete activityを送信する
|
|
||||||
await this.userSuspendService.doPostSuspend(user).catch(err => {});
|
|
||||||
|
|
||||||
this.queueService.createDeleteAccountJob(user, {
|
|
||||||
soft: false,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
this.queueService.createDeleteAccountJob(user, {
|
|
||||||
soft: true, // リモートユーザーの削除は、完全にDBから物理削除してしまうと再度連合してきてアカウントが復活する可能性があるため、soft指定する
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.usersRepository.update(user.id, {
|
|
||||||
isDeleted: true,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,18 +3,12 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IsNull, Not } from 'typeorm';
|
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { UsersRepository, FollowingsRepository } from '@/models/_.js';
|
import type { UsersRepository } from '@/models/_.js';
|
||||||
import type { MiUser } from '@/models/User.js';
|
|
||||||
import type { RelationshipJobData } from '@/queue/types.js';
|
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
|
||||||
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
import { bindThis } from '@/decorators.js';
|
|
||||||
import { RoleService } from '@/core/RoleService.js';
|
import { RoleService } from '@/core/RoleService.js';
|
||||||
import { QueueService } from '@/core/QueueService.js';
|
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
tags: ['admin'],
|
tags: ['admin'],
|
||||||
|
@ -38,13 +32,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
@Inject(DI.usersRepository)
|
@Inject(DI.usersRepository)
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
@Inject(DI.followingsRepository)
|
|
||||||
private followingsRepository: FollowingsRepository,
|
|
||||||
|
|
||||||
private userSuspendService: UserSuspendService,
|
private userSuspendService: UserSuspendService,
|
||||||
private roleService: RoleService,
|
private roleService: RoleService,
|
||||||
private moderationLogService: ModerationLogService,
|
|
||||||
private queueService: QueueService,
|
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||||
|
@ -57,42 +46,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new Error('cannot suspend moderator account');
|
throw new Error('cannot suspend moderator account');
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.usersRepository.update(user.id, {
|
await this.userSuspendService.suspend(user, me);
|
||||||
isSuspended: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.moderationLogService.log(me, 'suspend', {
|
|
||||||
userId: user.id,
|
|
||||||
userUsername: user.username,
|
|
||||||
userHost: user.host,
|
|
||||||
});
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await this.userSuspendService.doPostSuspend(user).catch(e => {});
|
|
||||||
await this.unFollowAll(user).catch(e => {});
|
|
||||||
})();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
|
||||||
private async unFollowAll(follower: MiUser) {
|
|
||||||
const followings = await this.followingsRepository.find({
|
|
||||||
where: {
|
|
||||||
followerId: follower.id,
|
|
||||||
followeeId: Not(IsNull()),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const jobs: RelationshipJobData[] = [];
|
|
||||||
for (const following of followings) {
|
|
||||||
if (following.followeeId && following.followerId) {
|
|
||||||
jobs.push({
|
|
||||||
from: { id: following.followerId },
|
|
||||||
to: { id: following.followeeId },
|
|
||||||
silent: true,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.queueService.createUnfollowJob(jobs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
import { Inject, Injectable } from '@nestjs/common';
|
import { Inject, Injectable } from '@nestjs/common';
|
||||||
import { Endpoint } from '@/server/api/endpoint-base.js';
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
||||||
import type { UsersRepository } from '@/models/_.js';
|
import type { UsersRepository } from '@/models/_.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
|
||||||
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
import { UserSuspendService } from '@/core/UserSuspendService.js';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.js';
|
||||||
|
|
||||||
|
@ -33,7 +32,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
private usersRepository: UsersRepository,
|
private usersRepository: UsersRepository,
|
||||||
|
|
||||||
private userSuspendService: UserSuspendService,
|
private userSuspendService: UserSuspendService,
|
||||||
private moderationLogService: ModerationLogService,
|
|
||||||
) {
|
) {
|
||||||
super(meta, paramDef, async (ps, me) => {
|
super(meta, paramDef, async (ps, me) => {
|
||||||
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
const user = await this.usersRepository.findOneBy({ id: ps.userId });
|
||||||
|
@ -42,17 +40,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
||||||
throw new Error('user not found');
|
throw new Error('user not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.usersRepository.update(user.id, {
|
await this.userSuspendService.unsuspend(user, me);
|
||||||
isSuspended: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.moderationLogService.log(me, 'unsuspend', {
|
|
||||||
userId: user.id,
|
|
||||||
userUsername: user.username,
|
|
||||||
userHost: user.host,
|
|
||||||
});
|
|
||||||
|
|
||||||
this.userSuspendService.doPostUnsuspend(user);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ export const moderationLogTypes = [
|
||||||
'createAbuseReportNotificationRecipient',
|
'createAbuseReportNotificationRecipient',
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
|
'deleteAccount',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
export type ModerationLogPayloads = {
|
export type ModerationLogPayloads = {
|
||||||
|
@ -314,6 +315,11 @@ export type ModerationLogPayloads = {
|
||||||
recipientId: string;
|
recipientId: string;
|
||||||
recipient: any;
|
recipient: any;
|
||||||
};
|
};
|
||||||
|
deleteAccount: {
|
||||||
|
userId: string;
|
||||||
|
userUsername: string;
|
||||||
|
userHost: string | null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Serialized<T> = {
|
export type Serialized<T> = {
|
||||||
|
|
|
@ -21,12 +21,12 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
].includes(log.type),
|
].includes(log.type),
|
||||||
[$style.logYellow]: [
|
[$style.logYellow]: [
|
||||||
'markSensitiveDriveFile',
|
'markSensitiveDriveFile',
|
||||||
'resetPassword'
|
'resetPassword',
|
||||||
|
'suspendRemoteInstance',
|
||||||
].includes(log.type),
|
].includes(log.type),
|
||||||
[$style.logRed]: [
|
[$style.logRed]: [
|
||||||
'suspend',
|
'suspend',
|
||||||
'deleteRole',
|
'deleteRole',
|
||||||
'suspendRemoteInstance',
|
|
||||||
'deleteGlobalAnnouncement',
|
'deleteGlobalAnnouncement',
|
||||||
'deleteUserAnnouncement',
|
'deleteUserAnnouncement',
|
||||||
'deleteCustomEmoji',
|
'deleteCustomEmoji',
|
||||||
|
@ -36,6 +36,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
'deleteAvatarDecoration',
|
'deleteAvatarDecoration',
|
||||||
'deleteSystemWebhook',
|
'deleteSystemWebhook',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
|
'deleteAccount',
|
||||||
].includes(log.type)
|
].includes(log.type)
|
||||||
}"
|
}"
|
||||||
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
>{{ i18n.ts._moderationLogTypes[log.type] }}</b>
|
||||||
|
@ -72,6 +73,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<span v-else-if="log.type === 'createAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
<span v-else-if="log.type === 'createAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
||||||
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
<span v-else-if="log.type === 'updateAbuseReportNotificationRecipient'">: {{ log.info.before.name }}</span>
|
||||||
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
<span v-else-if="log.type === 'deleteAbuseReportNotificationRecipient'">: {{ log.info.recipient.name }}</span>
|
||||||
|
<span v-else-if="log.type === 'deleteAccount'">: @{{ log.info.userUsername }}{{ log.info.userHost ? '@' + log.info.userHost : '' }}</span>
|
||||||
</template>
|
</template>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
<MkAvatar :user="log.user" :class="$style.avatar"/>
|
||||||
|
@ -143,7 +145,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="log.type === 'updateRemoteInstanceNote'">
|
<template v-else-if="log.type === 'updateRemoteInstanceNote'">
|
||||||
<div>{{ i18n.ts.user }}: {{ log.info.userId }}</div>
|
|
||||||
<div :class="$style.diff">
|
<div :class="$style.diff">
|
||||||
<CodeDiff :context="5" :hideHeader="true" :oldString="log.info.before ?? ''" :newString="log.info.after ?? ''" maxHeight="300px"/>
|
<CodeDiff :context="5" :hideHeader="true" :oldString="log.info.before ?? ''" :newString="log.info.after ?? ''" maxHeight="300px"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2478,10 +2478,13 @@ type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAbuseReportNotificationRecipient';
|
type: 'deleteAbuseReportNotificationRecipient';
|
||||||
info: ModerationLogPayloads['deleteAbuseReportNotificationRecipient'];
|
info: ModerationLogPayloads['deleteAbuseReportNotificationRecipient'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteAccount';
|
||||||
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
});
|
});
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient"];
|
export const moderationLogTypes: readonly ["updateServerSettings", "suspend", "unsuspend", "updateUserNote", "addCustomEmoji", "updateCustomEmoji", "deleteCustomEmoji", "assignRole", "unassignRole", "createRole", "updateRole", "deleteRole", "clearQueue", "promoteQueue", "deleteDriveFile", "deleteNote", "createGlobalAnnouncement", "createUserAnnouncement", "updateGlobalAnnouncement", "updateUserAnnouncement", "deleteGlobalAnnouncement", "deleteUserAnnouncement", "resetPassword", "suspendRemoteInstance", "unsuspendRemoteInstance", "updateRemoteInstanceNote", "markSensitiveDriveFile", "unmarkSensitiveDriveFile", "resolveAbuseReport", "createInvitation", "createAd", "updateAd", "deleteAd", "createAvatarDecoration", "updateAvatarDecoration", "deleteAvatarDecoration", "unsetUserAvatar", "unsetUserBanner", "createSystemWebhook", "updateSystemWebhook", "deleteSystemWebhook", "createAbuseReportNotificationRecipient", "updateAbuseReportNotificationRecipient", "deleteAbuseReportNotificationRecipient", "deleteAccount"];
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
type MuteCreateRequest = operations['mute___create']['requestBody']['content']['application/json'];
|
||||||
|
|
|
@ -154,6 +154,7 @@ export const moderationLogTypes = [
|
||||||
'createAbuseReportNotificationRecipient',
|
'createAbuseReportNotificationRecipient',
|
||||||
'updateAbuseReportNotificationRecipient',
|
'updateAbuseReportNotificationRecipient',
|
||||||
'deleteAbuseReportNotificationRecipient',
|
'deleteAbuseReportNotificationRecipient',
|
||||||
|
'deleteAccount',
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
// See: packages/backend/src/core/ReversiService.ts@L410
|
// See: packages/backend/src/core/ReversiService.ts@L410
|
||||||
|
@ -392,4 +393,9 @@ export type ModerationLogPayloads = {
|
||||||
recipientId: string;
|
recipientId: string;
|
||||||
recipient: AbuseReportNotificationRecipient;
|
recipient: AbuseReportNotificationRecipient;
|
||||||
};
|
};
|
||||||
|
deleteAccount: {
|
||||||
|
userId: string;
|
||||||
|
userUsername: string;
|
||||||
|
userHost: string | null;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -159,6 +159,9 @@ export type ModerationLog = {
|
||||||
} | {
|
} | {
|
||||||
type: 'deleteAbuseReportNotificationRecipient';
|
type: 'deleteAbuseReportNotificationRecipient';
|
||||||
info: ModerationLogPayloads['deleteAbuseReportNotificationRecipient'];
|
info: ModerationLogPayloads['deleteAbuseReportNotificationRecipient'];
|
||||||
|
} | {
|
||||||
|
type: 'deleteAccount';
|
||||||
|
info: ModerationLogPayloads['deleteAccount'];
|
||||||
});
|
});
|
||||||
|
|
||||||
export type ServerStats = {
|
export type ServerStats = {
|
||||||
|
|
Loading…
Reference in a new issue