Set draftChanged=true when changing draftAttachments, better logging
This commit is contained in:
parent
9374832ea4
commit
cd6e4bbe28
2 changed files with 6 additions and 6 deletions
|
@ -679,6 +679,7 @@ function addAttachment(
|
||||||
const conversation = window.ConversationController.get(conversationId);
|
const conversation = window.ConversationController.get(conversationId);
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
conversation.attributes.draftAttachments = nextAttachments;
|
conversation.attributes.draftAttachments = nextAttachments;
|
||||||
|
conversation.attributes.draftChanged = true;
|
||||||
window.Signal.Data.updateConversation(conversation.attributes);
|
window.Signal.Data.updateConversation(conversation.attributes);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -716,6 +717,7 @@ function addPendingAttachment(
|
||||||
const conversation = window.ConversationController.get(conversationId);
|
const conversation = window.ConversationController.get(conversationId);
|
||||||
if (conversation) {
|
if (conversation) {
|
||||||
conversation.attributes.draftAttachments = nextAttachments;
|
conversation.attributes.draftAttachments = nextAttachments;
|
||||||
|
conversation.attributes.draftChanged = true;
|
||||||
window.Signal.Data.updateConversation(conversation.attributes);
|
window.Signal.Data.updateConversation(conversation.attributes);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3619,15 +3619,12 @@ function onConversationClosed(
|
||||||
throw new Error('onConversationClosed: Conversation not found');
|
throw new Error('onConversationClosed: Conversation not found');
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info(
|
const logId = `onConversationClosed/${conversation.idForLogging()}`;
|
||||||
'unloading conversation',
|
log.info(`${logId}: unloading due to ${reason}`);
|
||||||
conversation.idForLogging(),
|
|
||||||
'due to:',
|
|
||||||
reason
|
|
||||||
);
|
|
||||||
|
|
||||||
if (conversation.get('draftChanged')) {
|
if (conversation.get('draftChanged')) {
|
||||||
if (conversation.hasDraft()) {
|
if (conversation.hasDraft()) {
|
||||||
|
log.info(`${logId}: new draft info needs update`);
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const activeAt = conversation.get('active_at') || now;
|
const activeAt = conversation.get('active_at') || now;
|
||||||
|
|
||||||
|
@ -3638,6 +3635,7 @@ function onConversationClosed(
|
||||||
timestamp: now,
|
timestamp: now,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
log.info(`${logId}: clearing draft info`);
|
||||||
conversation.set({
|
conversation.set({
|
||||||
draftChanged: false,
|
draftChanged: false,
|
||||||
draftTimestamp: null,
|
draftTimestamp: null,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue