mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-20 20:16:06 -04:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user