bug fixes

This commit is contained in:
MathMan05 2024-09-09 19:46:23 -05:00
parent cd15064d3a
commit 9e830ae520
6 changed files with 34 additions and 4 deletions

View file

@ -342,13 +342,16 @@ class Channel extends SnowFlake {
} }
static dragged = []; static dragged = [];
html; html;
get visable() {
return this.hasPermission("VIEW_CHANNEL");
}
createguildHTML(admin = false) { createguildHTML(admin = false) {
const div = document.createElement("div"); const div = document.createElement("div");
this.html = new WeakRef(div); this.html = new WeakRef(div);
if (!this.hasPermission("VIEW_CHANNEL")) { if (!this.visable) {
let quit = true; let quit = true;
for (const thing of this.children) { for (const thing of this.children) {
if (thing.hasPermission("VIEW_CHANNEL")) { if (thing.visable) {
quit = false; quit = false;
} }
} }
@ -651,6 +654,7 @@ class Channel extends SnowFlake {
const id = ++Channel.genid; const id = ++Channel.genid;
if (this.localuser.channelfocus) { if (this.localuser.channelfocus) {
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus = this;
} }
if (this.guild !== this.localuser.lookingguild) { if (this.guild !== this.localuser.lookingguild) {
this.guild.loadGuild(); this.guild.loadGuild();
@ -922,6 +926,9 @@ class Channel extends SnowFlake {
else if (removetitle) { else if (removetitle) {
removetitle.remove(); removetitle.remove();
} }
if (this.localuser.channelfocus !== this) {
return;
}
messages.append(await this.infinite.getDiv(id)); messages.append(await this.infinite.getDiv(id));
this.infinite.updatestuff(); this.infinite.updatestuff();
this.infinite.watchForChange().then(async (_) => { this.infinite.watchForChange().then(async (_) => {

View file

@ -152,6 +152,7 @@ class Group extends Channel {
const id = ++Channel.genid; const id = ++Channel.genid;
if (this.localuser.channelfocus) { if (this.localuser.channelfocus) {
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus = this;
} }
if (this.guild !== this.localuser.lookingguild) { if (this.guild !== this.localuser.lookingguild) {
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -532,6 +532,13 @@ class Localuser {
if (!guild) { if (!guild) {
guild = this.guildids.get("@me"); guild = this.guildids.get("@me");
} }
if (this.lookingguild === guild) {
return guild;
}
if (this.channelfocus) {
this.channelfocus.infinite.delete();
this.channelfocus = undefined;
}
if (this.lookingguild) { if (this.lookingguild) {
this.lookingguild.html.classList.remove("serveropen"); this.lookingguild.html.classList.remove("serveropen");
} }

View file

@ -355,13 +355,16 @@ class Channel extends SnowFlake{
} }
static dragged:[Channel,HTMLDivElement]|[]=[]; static dragged:[Channel,HTMLDivElement]|[]=[];
html:WeakRef<HTMLElement>|undefined; html:WeakRef<HTMLElement>|undefined;
get visable(){
return this.hasPermission("VIEW_CHANNEL")
}
createguildHTML(admin=false):HTMLDivElement{ createguildHTML(admin=false):HTMLDivElement{
const div=document.createElement("div"); const div=document.createElement("div");
this.html=new WeakRef(div); this.html=new WeakRef(div);
if(!this.hasPermission("VIEW_CHANNEL")){ if(!this.visable){
let quit=true; let quit=true;
for(const thing of this.children){ for(const thing of this.children){
if(thing.hasPermission("VIEW_CHANNEL")){ if(thing.visable){
quit=false; quit=false;
} }
} }
@ -662,6 +665,7 @@ class Channel extends SnowFlake{
const id=++Channel.genid; const id=++Channel.genid;
if(this.localuser.channelfocus){ if(this.localuser.channelfocus){
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus=this;
} }
if(this.guild!==this.localuser.lookingguild){ if(this.guild!==this.localuser.lookingguild){
this.guild.loadGuild(); this.guild.loadGuild();
@ -927,6 +931,9 @@ class Channel extends SnowFlake{
}else if(removetitle){ }else if(removetitle){
removetitle.remove(); removetitle.remove();
} }
if(this.localuser.channelfocus!==this){
return;
}
messages.append(await this.infinite.getDiv(id)); messages.append(await this.infinite.getDiv(id));
this.infinite.updatestuff(); this.infinite.updatestuff();
this.infinite.watchForChange().then(async _=>{ this.infinite.watchForChange().then(async _=>{

View file

@ -161,6 +161,7 @@ class Group extends Channel{
const id=++Channel.genid; const id=++Channel.genid;
if(this.localuser.channelfocus){ if(this.localuser.channelfocus){
this.localuser.channelfocus.infinite.delete(); this.localuser.channelfocus.infinite.delete();
this.localuser.channelfocus=this;
} }
if(this.guild!==this.localuser.lookingguild){ if(this.guild!==this.localuser.lookingguild){
this.guild.loadGuild(); this.guild.loadGuild();

View file

@ -520,6 +520,13 @@ class Localuser{
if(!guild){ if(!guild){
guild=this.guildids.get("@me"); guild=this.guildids.get("@me");
} }
if(this.lookingguild===guild){
return guild;
}
if(this.channelfocus){
this.channelfocus.infinite.delete();
this.channelfocus=undefined;
}
if(this.lookingguild){ if(this.lookingguild){
this.lookingguild.html.classList.remove("serveropen"); this.lookingguild.html.classList.remove("serveropen");
} }