mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
update timestamp when creating a new megolm session
This commit is contained in:
parent
aa62a5905d
commit
de143fdafc
@ -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 New Issue
Block a user