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