refactor: Use Set
This commit is contained in:
parent
667d58bad4
commit
41b491fa7c
|
@ -76,7 +76,7 @@ export default class DeliverManager {
|
||||||
public async execute() {
|
public async execute() {
|
||||||
if (!Users.isLocalUser(this.actor)) return;
|
if (!Users.isLocalUser(this.actor)) return;
|
||||||
|
|
||||||
const inboxes: string[] = [];
|
const inboxes = new Set<string>();
|
||||||
|
|
||||||
// build inbox list
|
// build inbox list
|
||||||
for (const recipe of this.recipes) {
|
for (const recipe of this.recipes) {
|
||||||
|
@ -89,13 +89,13 @@ export default class DeliverManager {
|
||||||
for (const following of followers) {
|
for (const following of followers) {
|
||||||
if (Followings.isRemoteFollower(following)) {
|
if (Followings.isRemoteFollower(following)) {
|
||||||
const inbox = following.followerSharedInbox || following.followerInbox;
|
const inbox = following.followerSharedInbox || following.followerInbox;
|
||||||
if (!inboxes.includes(inbox)) inboxes.push(inbox);
|
inboxes.add(inbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isDirect(recipe)) {
|
} else if (isDirect(recipe)) {
|
||||||
// direct deliver
|
// direct deliver
|
||||||
const inbox = recipe.to.inbox;
|
const inbox = recipe.to.inbox;
|
||||||
if (inbox && !inboxes.includes(inbox)) inboxes.push(inbox);
|
if (inbox) inboxes.add(inbox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue