From 536c25c2068b681e6981b640bc0557acb8863879 Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Wed, 16 Oct 2024 10:37:52 +0200 Subject: [PATCH] :recycle: Resolve minor errors on viewer role on dashboard --- backend/src/app/rpc/commands/projects.clj | 2 +- .../test/backend_tests/rpc_project_test.clj | 2 +- .../main/data/workspace/notifications.cljs | 6 +---- frontend/src/app/main/ui/dashboard/fonts.cljs | 22 ++++++++++--------- frontend/src/app/main/ui/dashboard/fonts.scss | 3 +++ .../app/main/ui/dashboard/placeholder.cljs | 2 +- frontend/translations/en.po | 15 ++++--------- frontend/translations/es.po | 17 ++++---------- 8 files changed, 27 insertions(+), 42 deletions(-) diff --git a/backend/src/app/rpc/commands/projects.clj b/backend/src/app/rpc/commands/projects.clj index 1b8310232..f3532f27f 100644 --- a/backend/src/app/rpc/commands/projects.clj +++ b/backend/src/app/rpc/commands/projects.clj @@ -222,7 +222,7 @@ ::webhooks/event? true} [{:keys [::db/pool] :as cfg} {:keys [::rpc/profile-id id team-id is-pinned] :as params}] (db/with-atomic [conn pool] - (check-edition-permissions! conn profile-id id) + (check-read-permissions! conn profile-id id) (db/exec-one! conn [sql:update-project-pin team-id id profile-id is-pinned is-pinned]) nil)) diff --git a/backend/test/backend_tests/rpc_project_test.clj b/backend/test/backend_tests/rpc_project_test.clj index f35105a97..4613e6257 100644 --- a/backend/test/backend_tests/rpc_project_test.clj +++ b/backend/test/backend_tests/rpc_project_test.clj @@ -152,7 +152,7 @@ (t/is (th/ex-info? error)) (t/is (th/ex-of-type? error :not-found)))) -(t/deftest permissions-checks-delete-project +(t/deftest permissions-checks-pin-project (let [profile1 (th/create-profile* 1) profile2 (th/create-profile* 2) project (th/create-project* 1 {:team-id (:default-team-id profile1) diff --git a/frontend/src/app/main/data/workspace/notifications.cljs b/frontend/src/app/main/data/workspace/notifications.cljs index 793a3ef1a..f670993ef 100644 --- a/frontend/src/app/main/data/workspace/notifications.cljs +++ b/frontend/src/app/main/data/workspace/notifications.cljs @@ -284,8 +284,4 @@ (watch [_ state _] (when (contains? (:workspace-libraries state) file-id) (rx/of (dwl/ext-library-changed file-id modified-at revn changes) - (dwl/notify-sync-file file-id)))))) - - - - + (dwl/notify-sync-file file-id)))))) \ No newline at end of file diff --git a/frontend/src/app/main/ui/dashboard/fonts.cljs b/frontend/src/app/main/ui/dashboard/fonts.cljs index c6c5d59af..9c2f09cf2 100644 --- a/frontend/src/app/main/ui/dashboard/fonts.cljs +++ b/frontend/src/app/main/ui/dashboard/fonts.cljs @@ -361,7 +361,8 @@ [:div {:class (stl/css :table-field :variants)} (for [{:keys [id] :as item} variants] - [:div {:class (stl/css :variant) + [:div {:class (stl/css-case :variant true + :inhert-variant you-viewer?) :key (dm/str id)} [:span {:class (stl/css :label)} [:& font-variant-display-name {:variant item}]] @@ -384,16 +385,17 @@ :on-click on-cancel} i/close]] - (when-not you-viewer? [:div {:class (stl/css :table-field :options)} - [:span {:class (stl/css :icon) - :on-click on-menu-open} - i/menu] + (when-not you-viewer? + [:div {:class (stl/css :table-field :options)} + [:span {:class (stl/css :icon) + :on-click on-menu-open} + i/menu] - [:& installed-font-context-menu - {:on-close on-menu-close - :is-open menu-open? - :on-delete on-delete-font - :on-edit on-edit}]]))])) + [:& installed-font-context-menu + {:on-close on-menu-close + :is-open menu-open? + :on-delete on-delete-font + :on-edit on-edit}]]))])) (mf/defc installed-fonts [{:keys [fonts you-viewer?] :as props}] diff --git a/frontend/src/app/main/ui/dashboard/fonts.scss b/frontend/src/app/main/ui/dashboard/fonts.scss index 4bfea724e..a49a10cbf 100644 --- a/frontend/src/app/main/ui/dashboard/fonts.scss +++ b/frontend/src/app/main/ui/dashboard/fonts.scss @@ -157,6 +157,9 @@ } } } + .inhert-variant { + cursor: default; + } } .table-field { diff --git a/frontend/src/app/main/ui/dashboard/placeholder.cljs b/frontend/src/app/main/ui/dashboard/placeholder.cljs index 00162f1c0..f49b795ae 100644 --- a/frontend/src/app/main/ui/dashboard/placeholder.cljs +++ b/frontend/src/app/main/ui/dashboard/placeholder.cljs @@ -33,7 +33,7 @@ :subtitle (when you-viewer? (tr "dashboard.empty-placeholder-libraries-subtitle-viewer-role")) :class (stl/css :empty-placeholder-libraries)} (when-not you-viewer? - [:> i18n/tr-html* {:content (tr "dashboard.empty-placeholder-drafts") + [:> i18n/tr-html* {:content (tr "dashboard.empty-placeholder-libraries") :class (stl/css :placeholder-markdown) :tag-name "span"}])] diff --git a/frontend/translations/en.po b/frontend/translations/en.po index cc3f836a4..461359658 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -434,18 +434,11 @@ msgstr "Duplicate %s files" #: src/app/main/ui/dashboard/placeholder.cljs:33 #, markdown -msgid "dashboard.empty-placeholder-drafts" +msgid "dashboard.empty-placeholder-libraries" msgstr "" -"Files added to Libraries will appear here. Try sharing your files or add " +"Libraries added to the project will appear here. Try sharing your files or add " "from our [Libraries & templates](https://penpot.app/libraries-templates)." - - - - - - - #: src/app/main/ui/dashboard/placeholder.cljs msgid "dashboard.empty-placeholder-libraries-title" msgstr "No libraries yet." @@ -454,12 +447,12 @@ msgstr "No libraries yet." #, markdown msgid "dashboard.empty-placeholder-libraries-subtitle" msgstr "" -"Files added to Libraries will appear here. Try sharing your files or add " +"Libraries added to the project will appear here. Try sharing your files or add " "from our [Libraries & templates](https://penpot.app/libraries-templates)." #: src/app/main/ui/dashboard/placeholder.cljs msgid "dashboard.empty-placeholder-libraries-subtitle-viewer-role" -msgstr "Files added to Libraries will appear here." +msgstr "Libraries added to the project will appear here." #: src/app/main/ui/dashboard msgid "dashboard.empty-placeholder-drafts-title" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 9b79b3e67..ef9a8e754 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -436,20 +436,12 @@ msgstr "Duplicar %s archivos" #: src/app/main/ui/dashboard/placeholder.cljs:33 #, markdown -msgid "dashboard.empty-placeholder-drafts" +msgid "dashboard.empty-placeholder-libraries" msgstr "" -"Los archivos agregados a las bibliotecas aparecerán aquí. Si quieres probar " +"Las bibliotecas añadidas al proyecto aparecerán aquí. Si quieres probar " "con alguna plantilla ve a [Bibliotecas y " "plantillas](https://penpot.app/libraries-templates)." -#: src/app/main/ui/dashboard/placeholder.cljs:33 -msgid "dashboard.empty-placeholder-drafts-viewer-role" -msgstr "" -"Los archivos agregados a las bibliotecas aparecerán aquí." - - - - #: src/app/main/ui/dashboard/placeholder.cljs msgid "dashboard.empty-placeholder-libraries-title" msgstr "Aún no existen librerías compartidas." @@ -458,14 +450,13 @@ msgstr "Aún no existen librerías compartidas." #, markdown msgid "dashboard.empty-placeholder-libraries-subtitle" msgstr "" -"Los archivos agregados a las bibliotecas aparecerán aquí. Si quieres probar " +"Las bibliotecas añadidas al proyecto aparecerán aquí. Si quieres probar " "con alguna plantilla ve a [Bibliotecas y " "plantillas](https://penpot.app/libraries-templates)." #: src/app/main/ui/dashboard/placeholder.cljs msgid "dashboard.empty-placeholder-libraries-subtitle-viewer-role" -msgstr "Los archivos agregados a las bibliotecas aparecerán aquí." - +msgstr "Las bibliotecas añadidas al proyecto aparecerán aquí." #: src/app/main/ui/dashboard/files.cljs msgid "dashboard.empty-placeholder-drafts-title"