mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-05 01:55:36 +02:00
無駄なAP deliverをしないように (#5589)
* DeliverManager, note/create * recipe * followers delivers * comment * rename * fix * cleanup
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import renderUpdate from '../../../remote/activitypub/renderer/update';
|
||||
import { renderActivity } from '../../../remote/activitypub/renderer';
|
||||
import { deliver } from '../../../queue';
|
||||
import renderNote from '../../../remote/activitypub/renderer/note';
|
||||
import { Users, Notes, Followings } from '../../../models';
|
||||
import { Users, Notes } from '../../../models';
|
||||
import { Note } from '../../../models/entities/note';
|
||||
import { deliverToFollowers } from '../../../remote/activitypub/deliver-manager';
|
||||
|
||||
export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const note = await Notes.findOne(noteId);
|
||||
@@ -12,26 +12,9 @@ export async function deliverQuestionUpdate(noteId: Note['id']) {
|
||||
const user = await Users.findOne(note.userId);
|
||||
if (user == null) throw new Error('note not found');
|
||||
|
||||
const followers = await Followings.find({
|
||||
followeeId: user.id
|
||||
});
|
||||
|
||||
const queue: string[] = [];
|
||||
|
||||
// フォロワーがリモートユーザーかつ投稿者がローカルユーザーならUpdateを配信
|
||||
if (Users.isLocalUser(user)) {
|
||||
for (const following of followers) {
|
||||
if (Followings.isRemoteFollower(following)) {
|
||||
const inbox = following.followerSharedInbox || following.followerInbox;
|
||||
if (!queue.includes(inbox)) queue.push(inbox);
|
||||
}
|
||||
}
|
||||
|
||||
if (queue.length > 0) {
|
||||
const content = renderActivity(renderUpdate(await renderNote(note, false), user));
|
||||
for (const inbox of queue) {
|
||||
deliver(user, content, inbox);
|
||||
}
|
||||
}
|
||||
const content = renderActivity(renderUpdate(await renderNote(note, false), user));
|
||||
deliverToFollowers(user, content);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user