UserSuspendServiceにおいてdeliverするのはAccoutUpdateにする
This commit is contained in:
parent
91fca71a43
commit
9ce03e5c9c
|
@ -10,11 +10,11 @@ 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';
|
||||||
import { DI } from '@/di-symbols.js';
|
import { DI } from '@/di-symbols.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 { RelationshipJobData } from '@/queue/types.js';
|
||||||
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
import { ModerationLogService } from '@/core/ModerationLogService.js';
|
||||||
|
import { AccountUpdateService } from '@/core/AccountUpdateService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class UserSuspendService {
|
export class UserSuspendService {
|
||||||
|
@ -31,7 +31,7 @@ export class UserSuspendService {
|
||||||
private userEntityService: UserEntityService,
|
private userEntityService: UserEntityService,
|
||||||
private queueService: QueueService,
|
private queueService: QueueService,
|
||||||
private globalEventService: GlobalEventService,
|
private globalEventService: GlobalEventService,
|
||||||
private apRendererService: ApRendererService,
|
private accountUpadateService: AccountUpdateService,
|
||||||
private moderationLogService: ModerationLogService,
|
private moderationLogService: ModerationLogService,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
@ -83,28 +83,7 @@ export class UserSuspendService {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.userEntityService.isLocalUser(user)) {
|
if (this.userEntityService.isLocalUser(user)) {
|
||||||
// 知り得る全SharedInboxにDelete配信
|
this.accountUpadateService.publishToFollowers(user.id);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,28 +92,7 @@ export class UserSuspendService {
|
||||||
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)) {
|
||||||
// 知り得る全SharedInboxにUndo Delete配信
|
this.accountUpadateService.publishToFollowers(user.id);
|
||||||
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()) },
|
|
||||||
{ 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 as any, content, inbox, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue