harden code
Massimo Melina committed
Oct 28, 2025 at 00:22 UTC
499d50364e2c0ae7c569063786471187fe83ed05
1 file changed
+2
-2
src/api.accounts.ts
+2
-2
@@ -23,10 +23,10 @@ function prepareAccount(ac: Account | undefined) {
23
invalidated: invalidateSessionBefore.get(ac.username),
24
directMembers: Object.values(accounts.get()).filter(a => a.belongs?.includes(ac.username)).map(x => x.username),
25
members: with_(Object.values(accounts.get()), accounts => {
26
- const ret = []
26
+ const ret: string[] = []
27
let news = [ac.username]
28
while (news.length) {
29
- news = accounts.filter(a => a.belongs?.some(x => news.includes(x))).map(x => x.username)
29
+ news = accounts.filter(a => !ret.includes(a.username) && a.belongs?.some(x => news.includes(x))).map(x => x.username)
30
ret.push(...news)
31
}
32
return _.uniq(ret).sort()