From 21e245c109db07078eb5d9f73d7461a95562de80 Mon Sep 17 00:00:00 2001 From: Anssi Kinnunen Date: Mon, 25 Nov 2024 19:07:45 +0200 Subject: [PATCH] fix: request reviewer buttons render "show more" Some actions, e.g links pass :text attribute instead of :label, and collapsible base action happened to only expect :label, which is the preferred way to pass label. Due to this cascade, request review action links rendered collapsible default "show more" instead of the actual translation. --- src/cljs/rems/collapsible.cljs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/cljs/rems/collapsible.cljs b/src/cljs/rems/collapsible.cljs index aa211a3f4..996e76611 100644 --- a/src/cljs/rems/collapsible.cljs +++ b/src/cljs/rems/collapsible.cljs @@ -36,7 +36,7 @@ (defn- base-action "Base attributes for collapsible action." - [{:keys [collapsible-id label] :as action}] + [{:keys [collapsible-id] :as action}] (let [state @(rf/subscribe [::expanded collapsible-id])] (-> action (dissoc :collapsible-id :hide? :on-close :on-open :show?) @@ -44,9 +44,11 @@ :aria-expanded (if state "true" "false")) - (assoc-some :label (cond label nil - state (text :t.collapse/hide) - :else (text :t.collapse/show)))))) + (assoc-some :label (when-not (or (:label action) + (:text action)) + (if state + (text :t.collapse/hide) + (text :t.collapse/show))))))) (defn focus-on-first-input [id] (focus/scroll-into-view-and-focus (rfmt/format "#%s .collapse-open :is(textarea, input)" id)))