mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-25 00:38:12 -05:00
Don't fetch backlog before read receipt
This commit is contained in:
parent
fce0936c20
commit
f47d93af8a
1 changed files with 9 additions and 1 deletions
|
@ -879,11 +879,19 @@ export default class App extends Component {
|
||||||
switch (msg.command) {
|
switch (msg.command) {
|
||||||
case irc.RPL_WELCOME:
|
case irc.RPL_WELCOME:
|
||||||
let lastReceipt = getLatestReceipt(this.bufferStore, client.params, ReceiptType.DELIVERED);
|
let lastReceipt = getLatestReceipt(this.bufferStore, client.params, ReceiptType.DELIVERED);
|
||||||
if (lastReceipt && lastReceipt.time && client.caps.enabled.has("draft/chathistory") && (!client.caps.enabled.has("soju.im/bouncer-networks") || client.params.bouncerNetwork)) {
|
if (lastReceipt && client.caps.enabled.has("draft/chathistory") && (!client.caps.enabled.has("soju.im/bouncer-networks") || client.params.bouncerNetwork)) {
|
||||||
let now = irc.formatDate(new Date());
|
let now = irc.formatDate(new Date());
|
||||||
client.fetchHistoryTargets(now, lastReceipt.time).then((targets) => {
|
client.fetchHistoryTargets(now, lastReceipt.time).then((targets) => {
|
||||||
targets.forEach((target) => {
|
targets.forEach((target) => {
|
||||||
|
// Maybe we've just received a READ update from the
|
||||||
|
// server, avoid over-fetching history
|
||||||
let from = lastReceipt;
|
let from = lastReceipt;
|
||||||
|
let stored = this.bufferStore.get({ name: target.name, server: client.params });
|
||||||
|
let readReceipt = getReceipt(stored, ReceiptType.READ);
|
||||||
|
if (readReceipt && readReceipt.time > from.time) {
|
||||||
|
from = readReceipt;
|
||||||
|
}
|
||||||
|
|
||||||
let to = { time: msg.tags.time || now };
|
let to = { time: msg.tags.time || now };
|
||||||
this.fetchBacklog(client, target.name, from, to);
|
this.fetchBacklog(client, target.name, from, to);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue