mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 23:25:13 +00:00
parent
202cb3048a
commit
5a3ea38bbf
1 changed files with 13 additions and 6 deletions
|
@ -8,7 +8,6 @@ import { registerOrFetchInstanceDoc } from '../register-or-fetch-instance-doc';
|
||||||
import { User } from '../../models/entities/user';
|
import { User } from '../../models/entities/user';
|
||||||
import { Note } from '../../models/entities/note';
|
import { Note } from '../../models/entities/note';
|
||||||
import { Notes, Users, Followings, Instances } from '../../models';
|
import { Notes, Users, Followings, Instances } from '../../models';
|
||||||
import { Not } from 'typeorm';
|
|
||||||
import { notesChart, perUserNotesChart, instanceChart } from '../chart';
|
import { notesChart, perUserNotesChart, instanceChart } from '../chart';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,13 +37,21 @@ export default async function(user: User, note: Note, quiet = false) {
|
||||||
if (Users.isLocalUser(user)) {
|
if (Users.isLocalUser(user)) {
|
||||||
const content = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${note.id}`), user));
|
const content = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${note.id}`), user));
|
||||||
|
|
||||||
const followings = await Followings.find({
|
const queue: string[] = [];
|
||||||
followeeId: user.id,
|
|
||||||
followerHost: Not(null)
|
const followers = await Followings.find({
|
||||||
|
followeeId: note.userId
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const following of followings) {
|
for (const following of followers) {
|
||||||
deliver(user, content, following.followerInbox);
|
if (Followings.isRemoteFollower(following)) {
|
||||||
|
const inbox = following.followerSharedInbox || following.followerInbox;
|
||||||
|
if (!queue.includes(inbox)) queue.push(inbox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const inbox of queue) {
|
||||||
|
deliver(user as any, content, inbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
Loading…
Reference in a new issue