Fix/server deletion lockup (#134)

* fix: Server deletion client lockup

Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com>

* fix: lint errors

Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com>

* fix lint error

Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com>

---------

Signed-off-by: mihai <45673304+mihaicm93@users.noreply.github.com>
Co-authored-by: Christopher Hultin <chris.hultin@gmail.com>
This commit is contained in:
Mihai
2026-03-03 05:17:03 +01:00
committed by GitHub
parent 7cdf5b1bce
commit b2a49fae3c
+5 -3
View File
@@ -136,9 +136,10 @@ export class Server {
* Channels
*/
get channels(): Channel[] {
return [
...this.#collection.getUnderlyingObject(this.id).channelIds.values(),
]
const channelIds = this.#collection.getUnderlyingObject(this.id).channelIds;
if (!channelIds) return [];
return [...channelIds.values()]
.map((id) => this.#collection.client.channels.get(id)!)
.filter((x) => x);
}
@@ -338,6 +339,7 @@ export class Server {
* Permission the currently authenticated user has against this server
*/
get permission(): bigint {
if (!this.$exists) return 0n;
return calculatePermission(this.#collection.client, this);
}