Fetch read marker before backlog for user targets

This commit is contained in:
Simon Ser 2022-09-03 14:31:56 +02:00
parent e7b69cec9a
commit 4780b9c709
2 changed files with 11 additions and 0 deletions

View file

@ -1128,6 +1128,12 @@ export default class App extends Component {
from = receiptFromMessage(lastMsg); from = receiptFromMessage(lastMsg);
} }
// Query read marker if this is a user (ie, we haven't received
// the read marker as part of a JOIN burst)
if (client.supportsReadMarker() && client.isNick(target.name)) {
client.fetchReadMarker(target.name);
}
client.fetchHistoryBetween(target.name, from, to, CHATHISTORY_MAX_SIZE).then((result) => { client.fetchHistoryBetween(target.name, from, to, CHATHISTORY_MAX_SIZE).then((result) => {
for (let msg of result.messages) { for (let msg of result.messages) {
let destBuffers = this.routeMessage(serverID, msg); let destBuffers = this.routeMessage(serverID, msg);

View file

@ -720,6 +720,11 @@ export default class Client extends EventTarget {
return chanTypes.indexOf(name[0]) >= 0; return chanTypes.indexOf(name[0]) >= 0;
} }
isNick(name) {
// A dollar sign is used for server-wide broadcasts
return !this.isServer(name) && !this.isChannel(name) && !name.startsWith('$');
}
setPingInterval(sec) { setPingInterval(sec) {
clearInterval(this.pingIntervalID); clearInterval(this.pingIntervalID);
this.pingIntervalID = null; this.pingIntervalID = null;