mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-22 17:25:08 +01:00
9c4e64b7b5
* Send Delete Person activity * Delete activityの後にフォロー解除する * アカウント削除でもDelete activity
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import renderDelete from '../remote/activitypub/renderer/delete';
|
|
import renderUndo from '../remote/activitypub/renderer/undo';
|
|
import { renderActivity } from '../remote/activitypub/renderer';
|
|
import { deliver } from '../queue';
|
|
import config from '../config';
|
|
import { User } from '../models/entities/user';
|
|
import { Users, Followings } from '../models';
|
|
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);
|
|
}
|
|
}
|
|
}
|