diff --git a/ts/components/EditHistoryMessagesModal.tsx b/ts/components/EditHistoryMessagesModal.tsx index 35166f00c116..88246f447d68 100644 --- a/ts/components/EditHistoryMessagesModal.tsx +++ b/ts/components/EditHistoryMessagesModal.tsx @@ -13,6 +13,8 @@ import { Modal } from './Modal'; import { WidthBreakpoint } from './_util'; import { shouldNeverBeCalled } from '../util/shouldNeverBeCalled'; import { useTheme } from '../hooks/useTheme'; +import { isSameDay } from '../util/timestamp'; +import { TimelineDateHeader } from './conversation/TimelineDateHeader'; export type PropsType = { closeEditHistoryModal: () => unknown; @@ -55,7 +57,7 @@ const MESSAGE_DEFAULT_PROPS = { scrollToQuotedMessage: shouldNeverBeCalled, shouldCollapseAbove: false, shouldCollapseBelow: false, - shouldHideMetadata: true, + shouldHideMetadata: false, showContactModal: shouldNeverBeCalled, showConversation: noop, showEditHistoryModal: shouldNeverBeCalled, @@ -144,39 +146,56 @@ export function EditHistoryMessagesModal({ {i18n('icu:EditHistoryMessagesModal__title')} - {pastEdits.map(messageAttributes => { + {pastEdits.map((messageAttributes, index) => { const syntheticId = `${messageAttributes.id}.${messageAttributes.timestamp}`; - return ( - previousItem.timestamp && + !isSameDay(previousItem.timestamp, messageAttributes.timestamp)) + ); + const dateHeaderElement = shouldShowDateHeader ? ( + { - const update = { - ...displayLimitById, - [messageId]: displayLimit, - }; - setDisplayLimitById(update); - }} - platform={platform} - showLightbox={closeAndShowLightbox} - showSpoiler={(messageId, data) => { - const update = { - ...revealedSpoilersById, - [messageId]: data, - }; - setRevealedSpoilersById(update); - }} - theme={theme} + timestamp={messageAttributes.timestamp} /> + ) : null; + + return ( + + {dateHeaderElement} + { + const update = { + ...displayLimitById, + [messageId]: displayLimit, + }; + setDisplayLimitById(update); + }} + platform={platform} + showLightbox={closeAndShowLightbox} + showSpoiler={(messageId, data) => { + const update = { + ...revealedSpoilersById, + [messageId]: data, + }; + setRevealedSpoilersById(update); + }} + theme={theme} + /> + ); })} diff --git a/ts/components/conversation/MessageMetadata.tsx b/ts/components/conversation/MessageMetadata.tsx index d261515379ab..89c3039acf4a 100644 --- a/ts/components/conversation/MessageMetadata.tsx +++ b/ts/components/conversation/MessageMetadata.tsx @@ -142,14 +142,14 @@ export function MessageMetadata({ } else { timestampNode = ( ); } diff --git a/ts/state/smart/EditHistoryMessagesModal.tsx b/ts/state/smart/EditHistoryMessagesModal.tsx index 163d94da552a..1eb966a8975e 100644 --- a/ts/state/smart/EditHistoryMessagesModal.tsx +++ b/ts/state/smart/EditHistoryMessagesModal.tsx @@ -39,7 +39,7 @@ export function SmartEditHistoryMessagesModal(): JSX.Element { return messagesAttributes.map(messageAttributes => ({ ...messagePropsSelector(messageAttributes as MessageAttributesType), // Make sure the messages don't get an "edited" badge - editHistory: undefined, + isEditedMessage: false, // Do not show the same reactions in the message history UI reactions: undefined, }));