From 09c274bd927016f7ff88ad13e18fa9f99ff53544 Mon Sep 17 00:00:00 2001 From: Milos Milic <124778054+MilosM348@users.noreply.github.com> Date: Thu, 28 May 2026 15:26:15 +0200 Subject: [PATCH] :bug: Match version preview banner text to History sidebar labels (#9697) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The version preview banner in `enter-preview` derives its title from `(:label snapshot)` directly. For system-created autosaves that field is the internal snapshot label (e.g. `internal/snapshot/20`), so the banner shows the raw internal string while the History sidebar already renders the same autosave through `workspace.versions.autosaved.version` plus a localized date. The mismatch makes it hard to be sure which sidebar entry you're previewing, especially when several autosaves sit close together (#9503). Switch the label resolution to mirror the sidebar's `snapshot-entry*`: - `:created-by "system"` snapshots format the label as `(tr "workspace.versions.autosaved.version" (ct/format-inst ... :localized-date))` — the exact same translation key + date format the sidebar's autosave group already uses - `:created-by "user"` (pinned) versions keep their custom `:label` with the existing `unnamed` fallback No behavior change for pinned/user-named versions or for the restore/exit dialog buttons. Closes #9503. Co-authored-by: Andrey Antukh --- .../src/app/main/data/workspace/versions.cljs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/workspace/versions.cljs b/frontend/src/app/main/data/workspace/versions.cljs index 67b10ca760..53d5e262f0 100644 --- a/frontend/src/app/main/data/workspace/versions.cljs +++ b/frontend/src/app/main/data/workspace/versions.cljs @@ -274,8 +274,24 @@ features (features/get-enabled-features state team-id) snapshot (->> (dm/get-in state [:workspace-versions :data]) (d/seek #(= id (:id %)))) - label (or (:label snapshot) - (tr "workspace.versions.preview.unnamed")) + ;; Match the History sidebar's identifying text so the + ;; preview banner and the sidebar entry "speak the same + ;; language" (#9503): + ;; - user-created (pinned) versions keep the user's custom + ;; label; if absent, fall back to "unnamed" + ;; - system-created autosaves use the same auto-generated + ;; label the sidebar's `snapshot-entry*` already renders + ;; via `workspace.versions.autosaved.version` + a + ;; localized date, instead of the internal snapshot + ;; label (e.g. `internal/snapshot/20`). + label (cond + (= "system" (:created-by snapshot)) + (tr "workspace.versions.autosaved.version" + (ct/format-inst (:created-at snapshot) :localized-date)) + + :else + (or (:label snapshot) + (tr "workspace.versions.preview.unnamed"))) output-s (rx/subject)] (rx/merge output-s