do not overwrite sent_at with network time for synced messages (#1921)

* do not update sent_at for synced messages

* reply to message context menu only visible if msg sent
pull/1930/head
Audric Ackermann 4 years ago committed by GitHub
parent 2e0cf0bca9
commit e9dfa0704f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,6 +64,7 @@ export const MessageContextMenu = (props: Props) => {
} = selected;
const { messageId, contextMenuId } = props;
const showRetry = status === 'error' && direction === 'outgoing';
const isSent = status === 'sent';
const multipleAttachments = attachments && attachments.length > 1;
const onContextMenuShown = useCallback(() => {
@ -168,7 +169,7 @@ export const MessageContextMenu = (props: Props) => {
) : null}
<Item onClick={copyText}>{window.i18n('copyMessage')}</Item>
<Item onClick={onReply}>{window.i18n('replyToMessage')}</Item>
{isSent && <Item onClick={onReply}>{window.i18n('replyToMessage')}</Item>}
<Item onClick={onShowDetail}>{window.i18n('moreInformation')}</Item>
{showRetry ? <Item onClick={onRetry}>{window.i18n('resend')}</Item> : null}
{isDeletable ? (

@ -31,6 +31,13 @@ function overwriteOutgoingTimestampWithNetworkTimestamp(message: RawMessage) {
const contentDecoded = SignalService.Content.decode(plainTextBuffer);
const { dataMessage, dataExtractionNotification, typingMessage } = contentDecoded;
if (dataMessage && dataMessage.timestamp && dataMessage.timestamp > 0) {
// this is a sync message, do not overwrite the message timestamp
if (dataMessage.syncTarget) {
return {
overRiddenTimestampBuffer: plainTextBuffer,
diffTimestamp: _.toNumber(dataMessage.timestamp),
};
}
dataMessage.timestamp = diffTimestamp;
}
if (
@ -86,7 +93,8 @@ export async function send(
// and the isDuplicate messages relies on sent_at timestamp to be valid.
const found = await Data.getMessageById(message.identifier);
if (found) {
// make sure to not update the send timestamp if this a currently syncing message
if (found && !found.get('sentSync')) {
found.set({ sent_at: diffTimestamp });
await found.commit();
}

Loading…
Cancel
Save