fix bugs with direct

This commit is contained in:
MathMan05 2024-09-07 17:38:07 -05:00
parent 512cc95ab4
commit a4fbc0ca6a
2 changed files with 20 additions and 6 deletions

View file

@ -123,21 +123,27 @@ class Group extends Channel {
}
async getHTML() {
const id = ++Channel.genid;
if (this.localuser.channelfocus) {
this.localuser.channelfocus.infinite.delete();
}
if (this.guild !== this.localuser.lookingguild) {
this.guild.loadGuild();
}
this.guild.prevchannel = this;
this.localuser.channelfocus = this;
const prom = this.infinite.delete();
history.pushState(null, "", "/channels/" + this.guild_id + "/" + this.id);
this.localuser.pageTitle("@" + this.name);
document.getElementById("channelTopic").setAttribute("hidden", "");
const loading = document.getElementById("loadingdiv");
Channel.regenLoadingMessages();
loading.classList.add("loading");
await this.putmessages();
await prom;
if (id !== Channel.genid) {
return;
}
this.buildmessages();
history.pushState(null, "", "/channels/" + this.guild_id + "/" + this.id);
this.localuser.pageTitle("@" + this.name);
document.getElementById("channelTopic").setAttribute("hidden", "");
document.getElementById("typebox").contentEditable = "" + true;
}
messageCreate(messagep) {

View file

@ -127,21 +127,29 @@ class Group extends Channel{
}
async getHTML(){
const id=++Channel.genid;
if(this.localuser.channelfocus){
this.localuser.channelfocus.infinite.delete();
}
if(this.guild!==this.localuser.lookingguild){
this.guild.loadGuild();
}
this.guild.prevchannel=this;
this.localuser.channelfocus=this;
const prom=this.infinite.delete();
history.pushState(null, "","/channels/"+this.guild_id+"/"+this.id);
this.localuser.pageTitle("@"+this.name);
(document.getElementById("channelTopic") as HTMLElement).setAttribute("hidden","");
const loading=document.getElementById("loadingdiv") as HTMLDivElement;
Channel.regenLoadingMessages();
loading.classList.add("loading");
await this.putmessages();
await prom;
if(id!==Channel.genid){
return;
}
this.buildmessages();
history.pushState(null, "","/channels/"+this.guild_id+"/"+this.id);
this.localuser.pageTitle("@"+this.name);
(document.getElementById("channelTopic") as HTMLElement).setAttribute("hidden","");
(document.getElementById("typebox") as HTMLDivElement).contentEditable=""+true;
}
messageCreate(messagep:{d:messagejson}){