forked from mystiq/hydrogen-web
update timestamp when creating a new megolm session
This commit is contained in:
parent
aa62a5905d
commit
de143fdafc
1 changed files with 6 additions and 4 deletions
|
@ -55,7 +55,7 @@ export class Encryption {
|
|||
let sessionEntry = await txn.outboundGroupSessions.get(roomId);
|
||||
roomKeyMessage = this._readOrCreateSession(session, sessionEntry, roomId, encryptionParams, txn);
|
||||
if (roomKeyMessage) {
|
||||
this._writeSession(sessionEntry, session, roomId, txn);
|
||||
this._writeSession(this._now(), session, roomId, txn);
|
||||
}
|
||||
} catch (err) {
|
||||
txn.abort();
|
||||
|
@ -85,11 +85,11 @@ export class Encryption {
|
|||
}
|
||||
}
|
||||
|
||||
_writeSession(sessionEntry, session, roomId, txn) {
|
||||
_writeSession(createdAt, session, roomId, txn) {
|
||||
txn.outboundGroupSessions.set({
|
||||
roomId,
|
||||
session: session.pickle(this._pickleKey),
|
||||
createdAt: sessionEntry?.createdAt || this._now(),
|
||||
createdAt,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,9 @@ export class Encryption {
|
|||
let sessionEntry = await txn.outboundGroupSessions.get(roomId);
|
||||
roomKeyMessage = this._readOrCreateSession(session, sessionEntry, roomId, encryptionParams, txn);
|
||||
encryptedContent = this._encryptContent(roomId, session, type, content);
|
||||
this._writeSession(sessionEntry, session, roomId, txn);
|
||||
// update timestamp when a new session is created
|
||||
const createdAt = roomKeyMessage ? this._now() : sessionEntry.createdAt;
|
||||
this._writeSession(createdAt, session, roomId, txn);
|
||||
|
||||
} catch (err) {
|
||||
txn.abort();
|
||||
|
|
Loading…
Reference in a new issue