summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/UserSuspendService.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/core/UserSuspendService.ts')
-rw-r--r--packages/backend/src/core/UserSuspendService.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/packages/backend/src/core/UserSuspendService.ts b/packages/backend/src/core/UserSuspendService.ts
index b197d335d8..28ae32681d 100644
--- a/packages/backend/src/core/UserSuspendService.ts
+++ b/packages/backend/src/core/UserSuspendService.ts
@@ -32,13 +32,13 @@ export class UserSuspendService {
@bindThis
public async doPostSuspend(user: { id: User['id']; host: User['host'] }): Promise<void> {
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: true });
-
+
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()) },
@@ -46,13 +46,13 @@ export class UserSuspendService {
],
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);
}
@@ -62,13 +62,13 @@ export class UserSuspendService {
@bindThis
public async doPostUnsuspend(user: User): Promise<void> {
this.globalEventService.publishInternalEvent('userChangeSuspendedState', { id: user.id, isSuspended: false });
-
+
if (this.userEntityService.isLocalUser(user)) {
// 知り得る全SharedInboxにUndo Delete配信
const content = this.apRendererService.addContext(this.apRendererService.renderUndo(this.apRendererService.renderDelete(this.userEntityService.genLocalUserUri(user.id), user), user));
-
+
const queue: string[] = [];
-
+
const followings = await this.followingsRepository.find({
where: [
{ followerSharedInbox: Not(IsNull()) },
@@ -76,13 +76,13 @@ export class UserSuspendService {
],
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 as any, content, inbox, true);
}