Adds logging for edit syncs processing
This commit is contained in:
parent
dda3bbc5b3
commit
3bf8adf6e1
4 changed files with 25 additions and 15 deletions
|
@ -15,6 +15,7 @@ import { shouldNeverBeCalled } from '../util/shouldNeverBeCalled';
|
|||
import { useTheme } from '../hooks/useTheme';
|
||||
import { isSameDay } from '../util/timestamp';
|
||||
import { TimelineDateHeader } from './conversation/TimelineDateHeader';
|
||||
import { drop } from '../util/drop';
|
||||
|
||||
export type PropsType = {
|
||||
closeEditHistoryModal: () => unknown;
|
||||
|
@ -132,6 +133,13 @@ export function EditHistoryMessagesModal({
|
|||
};
|
||||
setDisplayLimitById(update);
|
||||
}}
|
||||
onContextMenu={() => {
|
||||
drop(
|
||||
window.navigator.clipboard.writeText(
|
||||
String(currentMessage.timestamp)
|
||||
)
|
||||
);
|
||||
}}
|
||||
platform={platform}
|
||||
showLightbox={closeAndShowLightbox}
|
||||
showSpoiler={(messageId, data) => {
|
||||
|
@ -188,6 +196,13 @@ export function EditHistoryMessagesModal({
|
|||
};
|
||||
setDisplayLimitById(update);
|
||||
}}
|
||||
onContextMenu={() => {
|
||||
drop(
|
||||
window.navigator.clipboard.writeText(
|
||||
String(messageAttributes.timestamp)
|
||||
)
|
||||
);
|
||||
}}
|
||||
platform={platform}
|
||||
showLightbox={closeAndShowLightbox}
|
||||
showSpoiler={(messageId, data) => {
|
||||
|
|
|
@ -47,6 +47,8 @@ export function forMessage(message: MessageModel): Array<EditAttributesType> {
|
|||
export async function onEdit(edit: EditAttributesType): Promise<void> {
|
||||
edits.add(edit);
|
||||
|
||||
const logId = `Edits.onEdit(timestamp=${edit.message.timestamp};target=${edit.targetSentTimestamp})`;
|
||||
|
||||
try {
|
||||
// The conversation the edited message was in; we have to find it in the database
|
||||
// to to figure that out.
|
||||
|
@ -57,11 +59,7 @@ export async function onEdit(edit: EditAttributesType): Promise<void> {
|
|||
);
|
||||
|
||||
if (!targetConversation) {
|
||||
log.info(
|
||||
'No target conversation for edit',
|
||||
edit.fromId,
|
||||
edit.targetSentTimestamp
|
||||
);
|
||||
log.info(`${logId}: No target conversation`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -69,10 +67,7 @@ export async function onEdit(edit: EditAttributesType): Promise<void> {
|
|||
// Do not await, since this can deadlock the queue
|
||||
drop(
|
||||
targetConversation.queueJob('Edits.onEdit', async () => {
|
||||
log.info('Handling edit for', {
|
||||
targetSentTimestamp: edit.targetSentTimestamp,
|
||||
sentAt: edit.message.timestamp,
|
||||
});
|
||||
log.info(`${logId}: Handling edit`);
|
||||
|
||||
const messages = await window.Signal.Data.getMessagesBySentAt(
|
||||
edit.targetSentTimestamp
|
||||
|
@ -86,11 +81,7 @@ export async function onEdit(edit: EditAttributesType): Promise<void> {
|
|||
);
|
||||
|
||||
if (!targetMessage) {
|
||||
log.info(
|
||||
'No message for edit',
|
||||
edit.fromId,
|
||||
edit.targetSentTimestamp
|
||||
);
|
||||
log.info(`${logId}: No message`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -106,6 +97,6 @@ export async function onEdit(edit: EditAttributesType): Promise<void> {
|
|||
})
|
||||
);
|
||||
} catch (error) {
|
||||
log.error('Edits.onEdit error:', Errors.toLogFormat(error));
|
||||
log.error(`${logId} error:`, Errors.toLogFormat(error));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -751,6 +751,7 @@ function copyOverMessageAttributesIntoEditHistory(
|
|||
...messageAttributes,
|
||||
// Always take attachments from the edited message (they might be absent)
|
||||
attachments: undefined,
|
||||
editMessageTimestamp: undefined,
|
||||
quote: undefined,
|
||||
preview: [],
|
||||
...editedMessageAttributes,
|
||||
|
|
|
@ -42,6 +42,9 @@ export function SmartEditHistoryMessagesModal(): JSX.Element {
|
|||
isEditedMessage: false,
|
||||
// Do not show the same reactions in the message history UI
|
||||
reactions: undefined,
|
||||
// Make sure that the timestamp is the correct timestamp from attributes
|
||||
// not the one that the selector derives.
|
||||
timestamp: messageAttributes.timestamp,
|
||||
}));
|
||||
}, [messagesAttributes, messagePropsSelector]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue