small optimization: don't save belongs when empty

Massimo Melina committed Oct 26, 2024 at 23:26 UTC f6874cce58a8cf9cf2fb3a8dd1b30423e88a49e7
1 file changed +2
src/perm.ts
+2
@@ -88,6 +88,8 @@ export async function updateAccount(account: Account, change: Partial<Account> |
88 console.error(`account ${username} belongs to non-existing ${b}`)
89 return true
90 })
91 + if (!account.belongs.length)
92 + delete account.belongs
93 }
94 account.expire &&= new Date(account.expire)
95 if (username !== usernameWas)