Fix call history deletion from sync messages

This commit is contained in:
Jamie Kyle 2023-09-27 12:42:30 -07:00 committed by GitHub
parent 20ddca9684
commit 1cc478180e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 84 additions and 11 deletions

View file

@ -785,8 +785,18 @@ async function updateLocalCallHistory(
'updateLocalCallHistory: Saving call history:',
formatCallHistory(callHistory)
);
const isDeleted =
callHistory.status === DirectCallStatus.Deleted ||
callHistory.status === GroupCallStatus.Deleted;
await window.Signal.Data.saveCallHistory(callHistory);
window.reduxActions.callHistory.cacheCallHistory(callHistory);
if (isDeleted) {
window.reduxActions.callHistory.removeCallHistory(callHistory.callId);
} else {
window.reduxActions.callHistory.addCallHistory(callHistory);
}
const prevMessage =
await window.Signal.Data.getCallHistoryMessageByCallId({
@ -806,6 +816,13 @@ async function updateLocalCallHistory(
);
}
if (isDeleted) {
if (prevMessage != null) {
await window.Signal.Data.removeMessage(prevMessage.id);
}
return callHistory;
}
let unread = false;
if (callHistory.mode === CallMode.Direct) {
unread =