From 76b9c1c8590bc836ec7755876aa381a9be8b8950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marina=20L=C3=B3pez?= Date: Fri, 25 Sep 2026 10:42:29 +0200 Subject: [PATCH] :sparkles: Remove team design review (#11881) --- backend/src/app/rpc/management/nitrate.clj | 16 +++++++++++++-- .../rpc_management_nitrate_test.clj | 20 +++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/backend/src/app/rpc/management/nitrate.clj b/backend/src/app/rpc/management/nitrate.clj index 750c949fae..36e37aca9d 100644 --- a/backend/src/app/rpc/management/nitrate.clj +++ b/backend/src/app/rpc/management/nitrate.clj @@ -153,13 +153,25 @@ ;; ---- API: notify-team-change +(def ^:private schema:notify-team-change + [:or + cto/schema:team-with-organization + [:map + [:id ::sm/uuid] + [:organization + [:map + [:name ::sm/text]]]]]) + (sv/defmethod ::notify-team-change "Notify to Penpot a team change from nitrate" {::doc/added "2.18" - ::sm/params cto/schema:team-with-organization + ::sm/params schema:notify-team-change ::rpc/auth false} [cfg team] - (notifications/notify-team-change cfg (select-keys team [:id :is-your-penpot :organization]) nil) + (let [team (select-keys team [:id :is-your-penpot :organization]) + notification (when-not (get-in team [:organization :id]) + "dashboard.team-no-longer-belong-organization")] + (notifications/notify-team-change cfg team notification)) nil) ;; ---- API: notify-user-added-to-organization diff --git a/backend/test/backend_tests/rpc_management_nitrate_test.clj b/backend/test/backend_tests/rpc_management_nitrate_test.clj index 73137f5852..3aa81b7a2b 100644 --- a/backend/test/backend_tests/rpc_management_nitrate_test.clj +++ b/backend/test/backend_tests/rpc_management_nitrate_test.clj @@ -255,6 +255,26 @@ (t/is (= (:owner-id organization) (-> msg :team :organization :owner-id))) (t/is (= (:avatar-bg-url organization) (str (-> msg :team :organization :avatar-bg-url))))))) +(t/deftest notify-team-removal-publishes-event + (let [team-id (uuid/random) + organization-name "OrgA" + calls (atom []) + out (with-redefs [mbus/pub! (fn [_cfg & {:keys [topic message]}] + (swap! calls conj {:topic topic + :message message}))] + (th/management-command! {::th/type :notify-team-change + :id team-id + :organization {:name organization-name}}))] + (t/is (th/success? out)) + (t/is (= 1 (count @calls))) + (t/is (= uuid/zero (-> @calls first :topic))) + (let [msg (-> @calls first :message)] + (t/is (= :team-organization-change (:type msg))) + (t/is (= "dashboard.team-no-longer-belong-organization" (:notification msg))) + (t/is (= team-id (-> msg :team :id))) + (t/is (= organization-name (-> msg :team :organization :name))) + (t/is (nil? (-> msg :team :organization :id)))))) + (t/deftest notify-user-added-to-organization-creates-default-organization-team (with-mocks [nitrate-mock {:target 'app.nitrate/call :return (fn [_ m _]