more DM fixes
This commit is contained in:
parent
dc5b38eb21
commit
384b666ac2
2 changed files with 32 additions and 21 deletions
|
@ -183,6 +183,7 @@ class Group extends Channel{
|
|||
}
|
||||
this.infinite.addedBottom();
|
||||
}
|
||||
this.unreads();
|
||||
if(messagez.author===this.localuser.user){
|
||||
return;
|
||||
}
|
||||
|
@ -198,27 +199,32 @@ class Group extends Channel{
|
|||
notititle(message){
|
||||
return message.author.username;
|
||||
}
|
||||
readbottom(){
|
||||
super.readbottom();
|
||||
this.unreads();
|
||||
}
|
||||
all:WeakRef<HTMLElement>=new WeakRef(document.createElement("div"));
|
||||
noti:WeakRef<HTMLElement>=new WeakRef(document.createElement("div"));
|
||||
unreads(){
|
||||
const sentdms=document.getElementById("sentdms") as HTMLDivElement;//Need to change sometime
|
||||
let current:HTMLElement|null=null;
|
||||
for(const thing of sentdms.children){
|
||||
if(thing["all"]===this){
|
||||
current=thing as HTMLElement;
|
||||
}
|
||||
}
|
||||
const current=this.all.deref();
|
||||
if(this.hasunreads){
|
||||
if(current){
|
||||
current["noti"].textContent=this.mentions;return;
|
||||
{
|
||||
const noti=this.noti.deref();
|
||||
if(noti){
|
||||
noti.textContent=this.mentions+"";
|
||||
return;
|
||||
}
|
||||
}
|
||||
const div=document.createElement("div");
|
||||
div.classList.add("servernoti");
|
||||
const noti=document.createElement("div");
|
||||
noti.classList.add("unread","notiunread","pinged");
|
||||
noti.textContent=""+this.mentions;
|
||||
div["noti"]=noti;
|
||||
this.noti=new WeakRef(noti);
|
||||
div.append(noti);
|
||||
const buildpfp=this.user.buildpfp();
|
||||
div["all"]=this;
|
||||
this.all=new WeakRef(div);
|
||||
buildpfp.classList.add("mentioned");
|
||||
div.append(buildpfp);
|
||||
sentdms.append(div);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue