Skip to content

Commit c1892eb

Browse files
authored
fix(ui): use correct translation key for collection version restore modal (#15757)
### What? Fixed the restore version confirmation modal always showing the "global document" message, even for collection documents. ### Why? The `Restore` component unconditionally used the `version:aboutToRestoreGlobal` translation key. This caused the modal to display text like "Globale Dokument" (German) or "the global {label}" (English) when restoring a collection document version, which is incorrect. ### How? Conditionally select the translation key based on whether `globalConfig` is present: - `globalConfig` exists → `version:aboutToRestoreGlobal` - Otherwise → `version:aboutToRestore` Also removed an unused `serverURL` destructuring.
1 parent 929203c commit c1892eb

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • packages/next/src/views/Version/Restore

packages/next/src/views/Version/Restore/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const Restore: React.FC<Props> = ({
4848
const {
4949
config: {
5050
routes: { admin: adminRoute, api: apiRoute },
51-
serverURL,
5251
},
5352
} = useConfig()
5453

@@ -58,10 +57,13 @@ export const Restore: React.FC<Props> = ({
5857
const [draft, setDraft] = useState(false)
5958
const { startRouteTransition } = useRouteTransition()
6059

61-
const restoreMessage = t('version:aboutToRestoreGlobal', {
62-
label: getTranslation(label, i18n),
63-
versionDate: versionDateFormatted,
64-
})
60+
const restoreMessage = t(
61+
globalConfig ? 'version:aboutToRestoreGlobal' : 'version:aboutToRestore',
62+
{
63+
label: getTranslation(label, i18n),
64+
versionDate: versionDateFormatted,
65+
},
66+
)
6567

6668
const canRestoreAsDraft = status !== 'draft' && collectionConfig?.versions?.drafts
6769

0 commit comments

Comments
 (0)