diff --git a/services/project-history/app/js/SummarizedUpdatesManager.js b/services/project-history/app/js/SummarizedUpdatesManager.js index 7bc0840eba..c94074136b 100644 --- a/services/project-history/app/js/SummarizedUpdatesManager.js +++ b/services/project-history/app/js/SummarizedUpdatesManager.js @@ -252,6 +252,15 @@ function _shouldMergeUpdate(update, summarizedUpdate, labels) { if (update.meta.origin.kind !== summarizedUpdate.meta.origin.kind) { return false } + if (update.meta.origin.path !== summarizedUpdate.meta.origin.path) { + return false + } + if ( + update.meta.origin.kind === 'file-restore' && + update.meta.origin.timestamp !== summarizedUpdate.meta.origin.timestamp + ) { + return false + } } else { return false } diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 363f49811c..d174fc8665 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -399,6 +399,7 @@ "file_action_deleted": "", "file_action_edited": "", "file_action_renamed": "", + "file_action_restored": "", "file_already_exists": "", "file_already_exists_in_this_location": "", "file_name": "", diff --git a/services/web/frontend/js/features/history/components/change-list/file-restore-change.tsx b/services/web/frontend/js/features/history/components/change-list/file-restore-change.tsx new file mode 100644 index 0000000000..94fc30913f --- /dev/null +++ b/services/web/frontend/js/features/history/components/change-list/file-restore-change.tsx @@ -0,0 +1,22 @@ +import { formatTime } from '@/features/utils/format-date' +import { useTranslation } from 'react-i18next' +import { LoadedUpdate } from '../../services/types/update' + +function FileRestoreChange({ origin }: Pick) { + const { t } = useTranslation() + + if (!origin || origin.kind !== 'file-restore') { + return null + } + + return ( +
+ {t('file_action_restored', { + fileName: origin.path, + date: formatTime(origin.timestamp, 'Do MMMM, h:mm a'), + })} +
+ ) +} + +export default FileRestoreChange diff --git a/services/web/frontend/js/features/history/components/change-list/history-version.tsx b/services/web/frontend/js/features/history/components/change-list/history-version.tsx index 627f198e82..d0ee891afd 100644 --- a/services/web/frontend/js/features/history/components/change-list/history-version.tsx +++ b/services/web/frontend/js/features/history/components/change-list/history-version.tsx @@ -19,6 +19,7 @@ import HistoryDropdownContent from './dropdown/history-dropdown-content' import CompareItems from './dropdown/menu-item/compare-items' import CompareVersionDropdown from './dropdown/compare-version-dropdown' import { CompareVersionDropdownContentAllHistory } from './dropdown/compare-version-dropdown-content' +import FileRestoreChange from './file-restore-change' type HistoryVersionProps = { update: LoadedUpdate @@ -164,10 +165,14 @@ function HistoryVersion({ label={label} /> ))} - + {update.meta.origin?.kind === 'file-restore' ? ( + + ) : ( + + )} __fileName__ already exists in this location. If you wish to move this file, rename or remove the conflicting file and try again.", "file_name": "File Name",