mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
only clear unread if needed
This commit is contained in:
parent
00e20d2088
commit
2742162c8e
@ -197,20 +197,22 @@ export class Room extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async clearUnread() {
|
async clearUnread() {
|
||||||
const txn = await this._storage.readWriteTxn([
|
if (this.isUnread) {
|
||||||
this._storage.storeNames.roomSummary,
|
const txn = await this._storage.readWriteTxn([
|
||||||
]);
|
this._storage.storeNames.roomSummary,
|
||||||
let data;
|
]);
|
||||||
try {
|
let data;
|
||||||
data = this._summary.writeClearUnread(txn);
|
try {
|
||||||
} catch (err) {
|
data = this._summary.writeClearUnread(txn);
|
||||||
txn.abort();
|
} catch (err) {
|
||||||
throw err;
|
txn.abort();
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
await txn.complete();
|
||||||
|
this._summary.applyChanges(data);
|
||||||
|
this.emit("change");
|
||||||
|
this._emitCollectionChange(this);
|
||||||
}
|
}
|
||||||
await txn.complete();
|
|
||||||
this._summary.applyChanges(data);
|
|
||||||
this.emit("change");
|
|
||||||
this._emitCollectionChange(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
|
Loading…
Reference in New Issue
Block a user