From 4958da63e585a74ee09fec4ca433a5d03446dcd0 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 12 Dec 2024 11:45:58 +0100 Subject: [PATCH 1/6] :bug: Fix a new user shouldn't see the "What's new" popup --- backend/src/app/rpc/commands/auth.clj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/src/app/rpc/commands/auth.clj b/backend/src/app/rpc/commands/auth.clj index 062436dbe..cf9db7762 100644 --- a/backend/src/app/rpc/commands/auth.clj +++ b/backend/src/app/rpc/commands/auth.clj @@ -273,7 +273,8 @@ (merge {:viewed-tutorial? false :viewed-walkthrough? false :nudge {:big 10 :small 1} - :v2-info-shown true}) + :v2-info-shown true + :release-notes-viewed (:main cf/version)}) (db/tjson)) password (or (:password params) "!") From 24e51eef5bd3763b1f4611077caf9ebe29742023 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Thu, 12 Dec 2024 15:15:27 +0100 Subject: [PATCH 2/6] :bug: Fix viewer role is unable to generate thumbnails on dashboard --- backend/src/app/rpc/commands/files_thumbnails.clj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/src/app/rpc/commands/files_thumbnails.clj b/backend/src/app/rpc/commands/files_thumbnails.clj index eb7bf3c16..c3a5cb5d4 100644 --- a/backend/src/app/rpc/commands/files_thumbnails.clj +++ b/backend/src/app/rpc/commands/files_thumbnails.clj @@ -402,7 +402,10 @@ [cfg {:keys [::rpc/profile-id file-id] :as params}] (db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}] - (files/check-edition-permissions! conn profile-id file-id) + ;; TODO For now we check read permissions instead of write, + ;; to allow viewer users to update thumbnails. We might + ;; review this approach on the future. + (files/check-read-permissions! conn profile-id file-id) (when-not (db/read-only? conn) (let [media (create-file-thumbnail! cfg params)] {:uri (files/resolve-public-uri (:id media)) From 08516ac7cae02abfc927ad87a8b9b3eeace12480 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 13 Dec 2024 10:51:25 +0100 Subject: [PATCH 3/6] Revert ":sparkles: Add test AB renaming "Libraries" to "Add library"" This reverts commit ec7f8a6aa7be03870a69be123d54b309de75e9b9. --- .../app/main/ui/workspace/sidebar/assets.cljs | 20 +++++----------- .../app/main/ui/workspace/sidebar/assets.scss | 23 ------------------- frontend/translations/en.po | 3 --- frontend/translations/es.po | 3 --- 4 files changed, 6 insertions(+), 43 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 4ec585f2d..6c4d03a07 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -8,7 +8,6 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data.macros :as dm] - [app.config :as cf] [app.main.data.modal :as modal] [app.main.data.workspace :as dw] [app.main.data.workspace.assets :as dwa] @@ -87,7 +86,6 @@ section (:section filters) ordering (:ordering filters) reverse-sort? (= :desc ordering) - num-libs (count (mf/deref refs/workspace-libraries)) toggle-ordering (mf/use-fn @@ -157,18 +155,12 @@ [:article {:class (stl/css :assets-bar)} [:div {:class (stl/css :assets-header)} (when-not ^boolean read-only? - (if (and (cf/external-feature-flag "templates-02" "test") - (zero? num-libs)) - [:button {:class (stl/css :add-library-button) - :on-click show-libraries-dialog - :data-testid "libraries"} - (tr "workspace.assets.add-library")] - [:button {:class (stl/css :libraries-button) - :on-click show-libraries-dialog - :data-testid "libraries"} - [:span {:class (stl/css :libraries-icon)} - i/library] - (tr "workspace.assets.libraries")])) + [:button {:class (stl/css :libraries-button) + :on-click show-libraries-dialog + :data-testid "libraries"} + [:span {:class (stl/css :libraries-icon)} + i/library] + (tr "workspace.assets.libraries")]) [:div {:class (stl/css :search-wrapper)} [:& search-bar {:on-change on-search-term-change diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.scss b/frontend/src/app/main/ui/workspace/sidebar/assets.scss index 21f7af9d5..acb9f3431 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.scss @@ -25,50 +25,34 @@ width: 100%; margin-bottom: $s-4; border-radius: $s-8; - .libraries-icon { @include flexCenter; width: $s-24; height: 100%; - svg { @include flexCenter; @extend .button-icon; stroke: var(--icon-foreground); } } - &:hover { background-color: var(--button-secondary-background-color-hover); color: var(--button-secondary-foreground-color-hover); border: $s-1 solid var(--button-secondary-border-color-hover); - svg { stroke: var(--button-secondary-foreground-color-hover); } } - &:focus { background-color: var(--button-secondary-background-color-focus); color: var(--button-secondary-foreground-color-focus); border: $s-1 solid var(--button-secondary-border-color-focus); - svg { stroke: var(--button-secondary-foreground-color-focus); } } } -.add-library-button { - @extend .button-primary; - text-transform: uppercase; - gap: $s-2; - height: $s-32; - width: 100%; - margin-bottom: $s-4; - border-radius: $s-8; -} - .section-button { @include flexCenter; @include buttonStyle; @@ -78,39 +62,32 @@ border: $s-1 solid var(--input-border-color-rest); border-radius: $br-8 $br-2 $br-2 $br-8; background-color: var(--input-background-color-rest); - svg { height: $s-16; width: $s-16; stroke: var(--icon-foreground); } - &:focus { border: $s-1 solid var(--input-border-color-focus); outline: 0; background-color: var(--input-background-color-focus); color: var(--input-foreground-color-focus); - svg { background-color: var(--input-background-color-focus); } } - &:hover { border: $s-1 solid var(--input-border-color-hover); background-color: var(--input-background-color-hover); - svg { background-color: var(--input-background-color-hover); stroke: var(--button-foreground-hover); } - &:focus { border: $s-1 solid var(--input-border-color-focus); outline: 0; background-color: var(--input-background-color-focus); color: var(--input-foreground-color-focus); - svg { background-color: var(--input-background-color-focus); } diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 2c0b4b84a..a6d13afe9 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -4064,9 +4064,6 @@ msgstr "Group name" msgid "workspace.assets.libraries" msgstr "Libraries" -msgid "workspace.assets.add-library" -msgstr "Add library" - #: src/app/main/ui/workspace/sidebar/assets/components.cljs:523 msgid "workspace.assets.list-view" msgstr "List view" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 23691241e..0e17088a7 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -4064,9 +4064,6 @@ msgstr "Nombre del grupo" msgid "workspace.assets.libraries" msgstr "Bibliotecas" -msgid "workspace.assets.add-library" -msgstr "Añadir biblioteca" - #: src/app/main/ui/workspace/sidebar/assets/components.cljs:523 msgid "workspace.assets.list-view" msgstr "Ver como lista" From 664cacbe9d70bbfb8fc11ef4eaa334683de16592 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Tue, 3 Dec 2024 15:40:27 +0100 Subject: [PATCH 4/6] :sparkles: Add test AB renaming "Libraries" to "Add library" --- .../app/main/ui/workspace/sidebar/assets.cljs | 73 +++++++++++-------- .../app/main/ui/workspace/sidebar/assets.scss | 23 ++++++ frontend/translations/en.po | 3 + frontend/translations/es.po | 3 + 4 files changed, 71 insertions(+), 31 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs index 6c4d03a07..4104fc14a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.cljs @@ -8,6 +8,7 @@ (:require-macros [app.main.style :as stl]) (:require [app.common.data.macros :as dm] + [app.config :as cf] [app.main.data.modal :as modal] [app.main.data.workspace :as dw] [app.main.data.workspace.assets :as dwa] @@ -86,6 +87,10 @@ section (:section filters) ordering (:ordering filters) reverse-sort? (= :desc ordering) + num-libs (count (mf/deref refs/workspace-libraries)) + + show-templates-02-test? + (and (cf/external-feature-flag "templates-02" "test") (zero? num-libs)) toggle-ordering (mf/use-fn @@ -155,38 +160,44 @@ [:article {:class (stl/css :assets-bar)} [:div {:class (stl/css :assets-header)} (when-not ^boolean read-only? - [:button {:class (stl/css :libraries-button) - :on-click show-libraries-dialog - :data-testid "libraries"} - [:span {:class (stl/css :libraries-icon)} - i/library] - (tr "workspace.assets.libraries")]) + (if show-templates-02-test? + [:button {:class (stl/css :add-library-button) + :on-click show-libraries-dialog + :data-testid "libraries"} + (tr "workspace.assets.add-library")] + [:button {:class (stl/css :libraries-button) + :on-click show-libraries-dialog + :data-testid "libraries"} + [:span {:class (stl/css :libraries-icon)} + i/library] + (tr "workspace.assets.libraries")])) - [:div {:class (stl/css :search-wrapper)} - [:& search-bar {:on-change on-search-term-change - :value term - :placeholder (tr "workspace.assets.search")} - [:button - {:on-click on-open-menu - :title (tr "workspace.assets.filter") - :class (stl/css-case :section-button true - :opened menu-open?)} - i/filter-icon]] - [:> context-menu* - {:on-close on-menu-close - :selectable true - :selected section - :show menu-open? - :fixed true - :min-width true - :width size - :top 158 - :left 18 - :options options}] - [:> icon-button* {:variant "ghost" - :aria-label (tr "workspace.assets.sort") - :on-click toggle-ordering - :icon (if reverse-sort? "asc-sort" "desc-sort")}]]] + (when-not show-templates-02-test? + [:div {:class (stl/css :search-wrapper)} + [:& search-bar {:on-change on-search-term-change + :value term + :placeholder (tr "workspace.assets.search")} + [:button + {:on-click on-open-menu + :title (tr "workspace.assets.filter") + :class (stl/css-case :section-button true + :opened menu-open?)} + i/filter-icon]] + [:> context-menu* + {:on-close on-menu-close + :selectable true + :selected section + :show menu-open? + :fixed true + :min-width true + :width size + :top 158 + :left 18 + :options options}] + [:> icon-button* {:variant "ghost" + :aria-label (tr "workspace.assets.sort") + :on-click toggle-ordering + :icon (if reverse-sort? "asc-sort" "desc-sort")}]])] [:& (mf/provider cmm/assets-filters) {:value filters} [:& (mf/provider cmm/assets-toggle-ordering) {:value toggle-ordering} diff --git a/frontend/src/app/main/ui/workspace/sidebar/assets.scss b/frontend/src/app/main/ui/workspace/sidebar/assets.scss index acb9f3431..21f7af9d5 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/assets.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/assets.scss @@ -25,34 +25,50 @@ width: 100%; margin-bottom: $s-4; border-radius: $s-8; + .libraries-icon { @include flexCenter; width: $s-24; height: 100%; + svg { @include flexCenter; @extend .button-icon; stroke: var(--icon-foreground); } } + &:hover { background-color: var(--button-secondary-background-color-hover); color: var(--button-secondary-foreground-color-hover); border: $s-1 solid var(--button-secondary-border-color-hover); + svg { stroke: var(--button-secondary-foreground-color-hover); } } + &:focus { background-color: var(--button-secondary-background-color-focus); color: var(--button-secondary-foreground-color-focus); border: $s-1 solid var(--button-secondary-border-color-focus); + svg { stroke: var(--button-secondary-foreground-color-focus); } } } +.add-library-button { + @extend .button-primary; + text-transform: uppercase; + gap: $s-2; + height: $s-32; + width: 100%; + margin-bottom: $s-4; + border-radius: $s-8; +} + .section-button { @include flexCenter; @include buttonStyle; @@ -62,32 +78,39 @@ border: $s-1 solid var(--input-border-color-rest); border-radius: $br-8 $br-2 $br-2 $br-8; background-color: var(--input-background-color-rest); + svg { height: $s-16; width: $s-16; stroke: var(--icon-foreground); } + &:focus { border: $s-1 solid var(--input-border-color-focus); outline: 0; background-color: var(--input-background-color-focus); color: var(--input-foreground-color-focus); + svg { background-color: var(--input-background-color-focus); } } + &:hover { border: $s-1 solid var(--input-border-color-hover); background-color: var(--input-background-color-hover); + svg { background-color: var(--input-background-color-hover); stroke: var(--button-foreground-hover); } + &:focus { border: $s-1 solid var(--input-border-color-focus); outline: 0; background-color: var(--input-background-color-focus); color: var(--input-foreground-color-focus); + svg { background-color: var(--input-background-color-focus); } diff --git a/frontend/translations/en.po b/frontend/translations/en.po index a6d13afe9..2c0b4b84a 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -4064,6 +4064,9 @@ msgstr "Group name" msgid "workspace.assets.libraries" msgstr "Libraries" +msgid "workspace.assets.add-library" +msgstr "Add library" + #: src/app/main/ui/workspace/sidebar/assets/components.cljs:523 msgid "workspace.assets.list-view" msgstr "List view" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 0e17088a7..23691241e 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -4064,6 +4064,9 @@ msgstr "Nombre del grupo" msgid "workspace.assets.libraries" msgstr "Bibliotecas" +msgid "workspace.assets.add-library" +msgstr "Añadir biblioteca" + #: src/app/main/ui/workspace/sidebar/assets/components.cljs:523 msgid "workspace.assets.list-view" msgstr "Ver como lista" From 0945dd2920280cd3449c81b8f022e05ff76db8bf Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 13 Dec 2024 11:10:18 +0100 Subject: [PATCH 5/6] :tada: Add config flag to hide release info --- frontend/src/app/main/ui.cljs | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index 8898878db..90e3fbff4 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -67,6 +67,7 @@ show-release-modal? (and (contains? cf/flags :onboarding) + (not (contains? cf/flags :hide-release-modal)) (:onboarding-viewed props) (not= (:release-notes-viewed props) (:main cf/version)) (not= "0.0" (:main cf/version)))] From bbe0b22a8bc77ba8e178a914eaa97b7f2acbb714 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 13 Dec 2024 11:48:37 +0100 Subject: [PATCH 6/6] :bug: Fix unhandled exception on accepting invitation In an interaction with the audit log; happens when an old invitation (with created-by as nil) is accepted. --- backend/src/app/rpc/commands/verify_token.clj | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/backend/src/app/rpc/commands/verify_token.clj b/backend/src/app/rpc/commands/verify_token.clj index d725ceda2..27679536e 100644 --- a/backend/src/app/rpc/commands/verify_token.clj +++ b/backend/src/app/rpc/commands/verify_token.clj @@ -166,23 +166,26 @@ ;; invited team. (let [props {:team-id (:team-id claims) :role (:role claims) - :invitation-id (:id invitation)} + :invitation-id (:id invitation)}] - accept-invitation-event - (-> (audit/event-from-rpc-params params) - (assoc ::audit/name "accept-team-invitation") - (assoc ::audit/props props)) + (audit/submit! + cfg + (-> (audit/event-from-rpc-params params) + (assoc ::audit/name "accept-team-invitation") + (assoc ::audit/props props))) - accept-invitation-from-event - (-> (audit/event-from-rpc-params params) - (assoc ::audit/profile-id (:created-by invitation)) - (assoc ::audit/name "accept-team-invitation-from") - (assoc ::audit/props (assoc props - :profile-id (:id profile) - :email (:email profile))))] - - (audit/submit! cfg accept-invitation-event) - (audit/submit! cfg accept-invitation-from-event) + ;; NOTE: Backward compatibility; old invitations can + ;; have the `created-by` to be nil; so in this case we + ;; don't submit this event to the audit-log + (when-let [created-by (:created-by invitation)] + (audit/submit! + cfg + (-> (audit/event-from-rpc-params params) + (assoc ::audit/profile-id created-by) + (assoc ::audit/name "accept-team-invitation-from") + (assoc ::audit/props (assoc props + :profile-id (:id profile) + :email (:email profile)))))) (accept-invitation cfg claims invitation profile) (assoc claims :state :created))