mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Ensure conversation id in storeSession
This commit is contained in:
@@ -1566,13 +1566,23 @@ export default class MessageReceiver
|
||||
let p: Promise<void> = Promise.resolve();
|
||||
// eslint-disable-next-line no-bitwise
|
||||
if (msg.flags && msg.flags & Proto.DataMessage.Flags.END_SESSION) {
|
||||
const identifier = destination || destinationUuid;
|
||||
if (!identifier) {
|
||||
if (destinationUuid) {
|
||||
p = this.handleEndSession(new UUID(destinationUuid));
|
||||
} else if (destination) {
|
||||
const theirUuid = UUID.lookup(destination);
|
||||
if (theirUuid) {
|
||||
p = this.handleEndSession(theirUuid);
|
||||
} else {
|
||||
window.log.warn(
|
||||
`handleSentMessage: uuid not found for ${destination}`
|
||||
);
|
||||
p = Promise.resolve();
|
||||
}
|
||||
} else {
|
||||
throw new Error(
|
||||
'MessageReceiver.handleSentMessage: Cannot end session with falsey destination'
|
||||
);
|
||||
}
|
||||
p = this.handleEndSession(identifier);
|
||||
}
|
||||
await p;
|
||||
|
||||
@@ -1647,7 +1657,7 @@ export default class MessageReceiver
|
||||
await this.checkGroupV1Data(msg);
|
||||
|
||||
if (msg.flags && msg.flags & Proto.DataMessage.Flags.END_SESSION) {
|
||||
p = this.handleEndSession(destination);
|
||||
p = this.handleEndSession(new UUID(destination));
|
||||
}
|
||||
|
||||
if (msg.flags && msg.flags & Proto.DataMessage.Flags.PROFILE_KEY_UPDATE) {
|
||||
@@ -2557,14 +2567,10 @@ export default class MessageReceiver
|
||||
return downloadAttachment(this.server, cleaned);
|
||||
}
|
||||
|
||||
private async handleEndSession(identifier: string): Promise<void> {
|
||||
const theirUuid = UUID.lookup(identifier);
|
||||
if (!theirUuid) {
|
||||
window.log.warn(`handleEndSession: uuid not found for ${identifier}`);
|
||||
return;
|
||||
}
|
||||
|
||||
window.log.info(`handleEndSession: closing sessions for ${identifier}`);
|
||||
private async handleEndSession(theirUuid: UUID): Promise<void> {
|
||||
window.log.info(
|
||||
`handleEndSession: closing sessions for ${theirUuid.toString()}`
|
||||
);
|
||||
await this.storage.protocol.archiveAllSessions(theirUuid);
|
||||
}
|
||||
|
||||
|
||||
@@ -1664,7 +1664,7 @@ export default class MessageSender {
|
||||
proto.timestamp = timestamp;
|
||||
|
||||
const identifier = uuid || e164;
|
||||
const theirUuid = UUID.checkedLookup(identifier);
|
||||
const theirUuid = uuid ? new UUID(uuid) : UUID.checkedLookup(e164);
|
||||
|
||||
const logError = (prefix: string) => (error: Error) => {
|
||||
window.log.error(prefix, error && error.stack ? error.stack : error);
|
||||
|
||||
Reference in New Issue
Block a user