Make delivery receipts follow read receipts

If a message has been read, it's been delivered.

Fixes #23 at least partially.

References: https://todo.sr.ht/~emersion/gamja/23
This commit is contained in:
Simon Ser 2022-02-11 16:59:56 +01:00
parent 065b3f21fc
commit 77f54080e7

View file

@ -1,3 +1,5 @@
import { ReceiptType } from "./state.js";
const PREFIX = "gamja_";
class Item {
@ -90,6 +92,10 @@ export class Buffer {
updated = true;
}
});
if (receipts[ReceiptType.DELIVERED] < receipts[ReceiptType.READ]) {
receipts[ReceiptType.DELIVERED] = receipts[ReceiptType.READ];
updated = true;
}
}
if (!updated) {