more unread changes

This commit is contained in:
MathMan05
2026-01-27 19:55:30 -06:00
parent 0f167c1006
commit 7647b2398d
2 changed files with 14 additions and 10 deletions
+4 -3
View File
@@ -2890,6 +2890,10 @@ class Channel extends SnowFlake {
}
this.setLastMessageId(messagez.id);
if (this.infinite.atBottom()) {
this.lastreadmessageid = messagez.id;
}
this.unreads();
this.guild.unreads();
if (this === this.localuser.channelfocus) {
@@ -2902,9 +2906,6 @@ class Channel extends SnowFlake {
if (messagez.author === this.localuser.user) {
this.lastSentMessage = messagez;
this.slowmode();
this.lastreadmessageid = messagez.id;
this.lastmessage = messagez;
this.lastreadmessageid = messagez.id;
this.mentions = 0;
this.unreads();
this.guild.unreads();
+10 -7
View File
@@ -183,20 +183,23 @@ class InfiniteScroller {
snap();
}
snapBottom(): () => void {
const nothing = () => {};
atBottom() {
const scroll = this.scroller;
if (!scroll) return nothing;
if (!scroll) return false;
const last = this.weakElmId.get(Array.from(scroll.children).at(-1) as HTMLElement);
if (!last) return nothing;
if (this.backElm.get(last) || !this.backElm.has(last)) return nothing;
if (this.div) {
if (!last) return false;
if (this.backElm.get(last) || !this.backElm.has(last)) return false;
return this.scrollBottom < 4;
}
snapBottom(): () => void {
if (this.div && this.atBottom()) {
const trigger = this.scrollBottom < 4;
return () => {
if (this.div && trigger) this.div.scrollTop = this.div.scrollHeight;
};
} else {
return nothing;
return () => {};
}
}