Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
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 { Users, Followings } from "../models/index.js";
|
||||
import { Not, IsNull } from "typeorm";
|
||||
import { publishInternalEvent } from "./stream.js";
|
||||
export async function doPostUnsuspend(user) {
|
||||
publishInternalEvent("userChangeSuspendedState", {
|
||||
id: user.id,
|
||||
isSuspended: false
|
||||
});
|
||||
if (Users.isLocalUser(user)) {
|
||||
// 知り得る全SharedInboxにUndo Delete配信
|
||||
const content = renderActivity(renderUndo(renderDelete(`${config.url}/users/${user.id}`, user), user));
|
||||
const queue = [];
|
||||
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, content, inbox);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user