From 9e830ae520e9556729a6c4bec014280594142fe4 Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Mon, 9 Sep 2024 19:46:23 -0500 Subject: [PATCH] bug fixes --- .dist/channel.js | 11 +++++++++-- .dist/direct.js | 1 + .dist/localuser.js | 7 +++++++ webpage/channel.ts | 11 +++++++++-- webpage/direct.ts | 1 + webpage/localuser.ts | 7 +++++++ 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/.dist/channel.js b/.dist/channel.js index 87ccb76..cf1aa1c 100644 --- a/.dist/channel.js +++ b/.dist/channel.js @@ -342,13 +342,16 @@ class Channel extends SnowFlake { } static dragged = []; html; + get visable() { + return this.hasPermission("VIEW_CHANNEL"); + } createguildHTML(admin = false) { const div = document.createElement("div"); this.html = new WeakRef(div); - if (!this.hasPermission("VIEW_CHANNEL")) { + if (!this.visable) { let quit = true; for (const thing of this.children) { - if (thing.hasPermission("VIEW_CHANNEL")) { + if (thing.visable) { quit = false; } } @@ -651,6 +654,7 @@ class Channel extends SnowFlake { const id = ++Channel.genid; if (this.localuser.channelfocus) { this.localuser.channelfocus.infinite.delete(); + this.localuser.channelfocus = this; } if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); @@ -922,6 +926,9 @@ class Channel extends SnowFlake { else if (removetitle) { removetitle.remove(); } + if (this.localuser.channelfocus !== this) { + return; + } messages.append(await this.infinite.getDiv(id)); this.infinite.updatestuff(); this.infinite.watchForChange().then(async (_) => { diff --git a/.dist/direct.js b/.dist/direct.js index cdcad07..3a7abbd 100644 --- a/.dist/direct.js +++ b/.dist/direct.js @@ -152,6 +152,7 @@ class Group extends Channel { const id = ++Channel.genid; if (this.localuser.channelfocus) { this.localuser.channelfocus.infinite.delete(); + this.localuser.channelfocus = this; } if (this.guild !== this.localuser.lookingguild) { this.guild.loadGuild(); diff --git a/.dist/localuser.js b/.dist/localuser.js index 6c097f4..4810e4a 100644 --- a/.dist/localuser.js +++ b/.dist/localuser.js @@ -532,6 +532,13 @@ class Localuser { if (!guild) { guild = this.guildids.get("@me"); } + if (this.lookingguild === guild) { + return guild; + } + if (this.channelfocus) { + this.channelfocus.infinite.delete(); + this.channelfocus = undefined; + } if (this.lookingguild) { this.lookingguild.html.classList.remove("serveropen"); } diff --git a/webpage/channel.ts b/webpage/channel.ts index 0298ab2..f63ecc7 100644 --- a/webpage/channel.ts +++ b/webpage/channel.ts @@ -355,13 +355,16 @@ class Channel extends SnowFlake{ } static dragged:[Channel,HTMLDivElement]|[]=[]; html:WeakRef|undefined; + get visable(){ + return this.hasPermission("VIEW_CHANNEL") + } createguildHTML(admin=false):HTMLDivElement{ const div=document.createElement("div"); this.html=new WeakRef(div); - if(!this.hasPermission("VIEW_CHANNEL")){ + if(!this.visable){ let quit=true; for(const thing of this.children){ - if(thing.hasPermission("VIEW_CHANNEL")){ + if(thing.visable){ quit=false; } } @@ -662,6 +665,7 @@ class Channel extends SnowFlake{ const id=++Channel.genid; if(this.localuser.channelfocus){ this.localuser.channelfocus.infinite.delete(); + this.localuser.channelfocus=this; } if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); @@ -927,6 +931,9 @@ class Channel extends SnowFlake{ }else if(removetitle){ removetitle.remove(); } + if(this.localuser.channelfocus!==this){ + return; + } messages.append(await this.infinite.getDiv(id)); this.infinite.updatestuff(); this.infinite.watchForChange().then(async _=>{ diff --git a/webpage/direct.ts b/webpage/direct.ts index caf13a2..0f4e93c 100644 --- a/webpage/direct.ts +++ b/webpage/direct.ts @@ -161,6 +161,7 @@ class Group extends Channel{ const id=++Channel.genid; if(this.localuser.channelfocus){ this.localuser.channelfocus.infinite.delete(); + this.localuser.channelfocus=this; } if(this.guild!==this.localuser.lookingguild){ this.guild.loadGuild(); diff --git a/webpage/localuser.ts b/webpage/localuser.ts index 73400b9..51981cb 100644 --- a/webpage/localuser.ts +++ b/webpage/localuser.ts @@ -520,6 +520,13 @@ class Localuser{ if(!guild){ guild=this.guildids.get("@me"); } + if(this.lookingguild===guild){ + return guild; + } + if(this.channelfocus){ + this.channelfocus.infinite.delete(); + this.channelfocus=undefined; + } if(this.lookingguild){ this.lookingguild.html.classList.remove("serveropen"); }