mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 04:09:49 +00:00
Avoid foreign key error if message is deleted before saving attachments
This commit is contained in:
@@ -2997,10 +2997,6 @@ function saveMessage(
|
||||
} satisfies Omit<MessageTypeUnhydrated, 'json'>;
|
||||
|
||||
if (id && !forceSave) {
|
||||
if (normalizeAttachmentData) {
|
||||
saveMessageAttachments(db, message);
|
||||
}
|
||||
|
||||
const result = db
|
||||
.prepare(
|
||||
// UPDATE queries that set the value of a primary key column can be very slow when
|
||||
@@ -3019,6 +3015,10 @@ function saveMessage(
|
||||
return id;
|
||||
}
|
||||
|
||||
if (normalizeAttachmentData) {
|
||||
saveMessageAttachments(db, message);
|
||||
}
|
||||
|
||||
if (jobToInsert) {
|
||||
insertJob(db, jobToInsert);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user