mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 15:56:43 -06:00
d071d18dd7
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import renderDelete from '@/remote/activitypub/renderer/delete.js';
|
|
import renderUndo from '@/remote/activitypub/renderer/undo.js';
|
|
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
|
import { deliver } from '@/queue/index.js';
|
|
import config from '@/config/index.js';
|
|
import { User } from '@/models/entities/user.js';
|
|
import { Users, Followings } from '@/models/index.js';
|
|
import { Not, IsNull } from 'typeorm';
|
|
|
|
export async function doPostUnsuspend(user: User) {
|
|
if (Users.isLocalUser(user)) {
|
|
// 知り得る全SharedInboxにUndo Delete配信
|
|
const content = renderActivity(renderUndo(renderDelete(`${config.url}/users/${user.id}`, user), user));
|
|
|
|
const queue: string[] = [];
|
|
|
|
const followings = await Followings.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) {
|
|
deliver(user as any, content, inbox);
|
|
}
|
|
}
|
|
}
|