mirror of
https://github.com/penpot/penpot.git
synced 2026-09-30 15:56:17 +00:00
✨ Remove team design review (#11881)
This commit is contained in:
parent
f35e12f716
commit
76b9c1c859
@ -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
|
||||
|
||||
@ -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 _]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user