mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Handle edge cases with empty channels
This commit is contained in:
parent
62ae4825ca
commit
57669576c9
@ -1230,8 +1230,11 @@
|
|||||||
jumpscroll = true;
|
jumpscroll = true;
|
||||||
} else {
|
} else {
|
||||||
fet = fetch(channel_id, last_message_id);
|
fet = fetch(channel_id, last_message_id);
|
||||||
|
jumpscroll = false;
|
||||||
|
if (last_message_id) {
|
||||||
jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent());
|
jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
fet.done(function(data) {
|
fet.done(function(data) {
|
||||||
var status = data.status;
|
var status = data.status;
|
||||||
if (visitor_mode) {
|
if (visitor_mode) {
|
||||||
@ -1717,7 +1720,10 @@
|
|||||||
if (selected_channel != thismsgchan) {
|
if (selected_channel != thismsgchan) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent());
|
var jumpscroll = false;
|
||||||
|
if (last_message_id) {
|
||||||
|
jumpscroll = element_in_view($('#discordmessage_'+last_message_id).parent());
|
||||||
|
}
|
||||||
last_message_id = fill_discord_messages([msg], jumpscroll);
|
last_message_id = fill_discord_messages([msg], jumpscroll);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1727,7 +1733,12 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$("#discordmessage_"+msg.id).parent().remove();
|
$("#discordmessage_"+msg.id).parent().remove();
|
||||||
last_message_id = $("#chatcontent").find("[id^=discordmessage_]").last().attr('id').substring(15);
|
var lastelem = $("#chatcontent").find("[id^=discordmessage_]").last();
|
||||||
|
if (!lastelem.length) {
|
||||||
|
last_message_id = null;
|
||||||
|
} else {
|
||||||
|
last_message_id = lastelem.attr('id').substring(15);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
socket.on("MESSAGE_UPDATE", function (msg) {
|
socket.on("MESSAGE_UPDATE", function (msg) {
|
||||||
|
Loading…
Reference in New Issue
Block a user