Fix potential issue of history not loading when showInActive is set
This commit is contained in:
parent
959ec5b598
commit
75eb812f05
@ -232,8 +232,16 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastMessage = this.channel.messages[0];
|
let lastMessage = -1;
|
||||||
lastMessage = lastMessage ? lastMessage.id : -1;
|
|
||||||
|
// Find the id of first message that isn't showInActive
|
||||||
|
// If showInActive is set, this message is actually in another channel
|
||||||
|
for (const message of this.channel.messages) {
|
||||||
|
if (!message.showInActive) {
|
||||||
|
lastMessage = message.id;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.channel.historyLoading = true;
|
this.channel.historyLoading = true;
|
||||||
|
|
||||||
|
@ -39,7 +39,13 @@ socket.on("msg", function(data) {
|
|||||||
) {
|
) {
|
||||||
channel = vueApp.activeChannel.channel;
|
channel = vueApp.activeChannel.channel;
|
||||||
|
|
||||||
|
if (data.chan === channel.id) {
|
||||||
|
// If active channel is the intended channel for this message,
|
||||||
|
// remove the showInActive flag
|
||||||
|
data.msg.showInActive = false;
|
||||||
|
} else {
|
||||||
data.chan = channel.id;
|
data.chan = channel.id;
|
||||||
|
}
|
||||||
} else if (!isActiveChannel) {
|
} else if (!isActiveChannel) {
|
||||||
// Do not set unread counter for channel if it is currently active on this client
|
// Do not set unread counter for channel if it is currently active on this client
|
||||||
// It may increase on the server before it processes channel open event from this client
|
// It may increase on the server before it processes channel open event from this client
|
||||||
|
@ -84,6 +84,11 @@ Chan.prototype.pushMessage = function(client, msg, increasesUnread) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// showInActive is only processed on "msg", don't need it on page reload
|
||||||
|
if (msg.showInActive) {
|
||||||
|
delete msg.showInActive;
|
||||||
|
}
|
||||||
|
|
||||||
this.writeUserLog(client, msg);
|
this.writeUserLog(client, msg);
|
||||||
|
|
||||||
if (Helper.config.maxHistory >= 0 && this.messages.length > Helper.config.maxHistory) {
|
if (Helper.config.maxHistory >= 0 && this.messages.length > Helper.config.maxHistory) {
|
||||||
|
Loading…
Reference in New Issue
Block a user