mirror of
https://github.com/penpot/penpot.git
synced 2026-09-08 13:09:22 +00:00
✨ Add props to invitations and organizations events (#11508)
This commit is contained in:
parent
80dea409c6
commit
f2f352d06c
@ -235,9 +235,8 @@
|
|||||||
:organization-name (:name organization)
|
:organization-name (:name organization)
|
||||||
:member-email (:email-to invitation)
|
:member-email (:email-to invitation)
|
||||||
:member-id (:id member)
|
:member-id (:id member)
|
||||||
:role role}
|
:role role
|
||||||
organization
|
:user-who-send-invitation (str profile-id)}
|
||||||
(assoc :user-who-send-invitation (str profile-id))
|
|
||||||
|
|
||||||
(not organization)
|
(not organization)
|
||||||
(assoc :team-belongs-to-organization (boolean team-organization-id)
|
(assoc :team-belongs-to-organization (boolean team-organization-id)
|
||||||
|
|||||||
@ -308,7 +308,9 @@
|
|||||||
(assoc :name "accept-organization-invitation")
|
(assoc :name "accept-organization-invitation")
|
||||||
(assoc :props
|
(assoc :props
|
||||||
(-> props
|
(-> props
|
||||||
(assoc :organization-id organization-id-on-add)
|
(assoc :organization-id organization-id-on-add
|
||||||
|
:user-id (:id profile)
|
||||||
|
:user-who-send-invitation (:created-by invitation))
|
||||||
(audit/clean-props))))))
|
(audit/clean-props))))))
|
||||||
|
|
||||||
(cond-> (assoc claims :state :created)
|
(cond-> (assoc claims :state :created)
|
||||||
@ -325,6 +327,8 @@
|
|||||||
(assoc :organization-id organization-id-on-add
|
(assoc :organization-id organization-id-on-add
|
||||||
:organization-member-add-source organization-add-source
|
:organization-member-add-source organization-add-source
|
||||||
:belongs-to-team-on-add (boolean team-id)
|
:belongs-to-team-on-add (boolean team-id)
|
||||||
|
:user-id (:id profile)
|
||||||
|
:user-who-send-invitation (:created-by invitation)
|
||||||
:organization-member-count-before
|
:organization-member-count-before
|
||||||
organization-member-count-before)
|
organization-member-count-before)
|
||||||
(audit/clean-props))}))))))
|
(audit/clean-props))}))))))
|
||||||
|
|||||||
@ -154,10 +154,14 @@
|
|||||||
(get-in % [:props :member-email])))
|
(get-in % [:props :member-email])))
|
||||||
events))]
|
events))]
|
||||||
(doseq [event [create-organization update-organization]]
|
(doseq [event [create-organization update-organization]]
|
||||||
|
(t/is (= (str (:id owner))
|
||||||
|
(get-in event [:props :user-who-send-invitation])))
|
||||||
(t/is (true? (get-in event [:props :team-belongs-to-organization])))
|
(t/is (true? (get-in event [:props :team-belongs-to-organization])))
|
||||||
(t/is (true? (get-in event [:props :adds-invitee-to-organization])))
|
(t/is (true? (get-in event [:props :adds-invitee-to-organization])))
|
||||||
(t/is (true? (get-in event [:props :invitee-already-organization-member]))))
|
(t/is (true? (get-in event [:props :invitee-already-organization-member]))))
|
||||||
|
|
||||||
|
(t/is (= (str (:id owner))
|
||||||
|
(get-in create-plain [:props :user-who-send-invitation])))
|
||||||
(t/is (false? (get-in create-plain [:props :team-belongs-to-organization])))
|
(t/is (false? (get-in create-plain [:props :team-belongs-to-organization])))
|
||||||
(t/is (false? (get-in create-plain [:props :adds-invitee-to-organization])))
|
(t/is (false? (get-in create-plain [:props :adds-invitee-to-organization])))
|
||||||
(t/is (false? (get-in create-plain [:props :invitee-already-organization-member])))))))
|
(t/is (false? (get-in create-plain [:props :invitee-already-organization-member])))))))
|
||||||
@ -521,6 +525,9 @@
|
|||||||
|
|
||||||
(let [event (organization-event)]
|
(let [event (organization-event)]
|
||||||
(t/is (= organization-id (get-in event [:props :organization-id])))
|
(t/is (= organization-id (get-in event [:props :organization-id])))
|
||||||
|
(t/is (= (:id invitee) (get-in event [:props :user-id])))
|
||||||
|
(t/is (= (:id inviter)
|
||||||
|
(get-in event [:props :user-who-send-invitation])))
|
||||||
(t/is (not (contains? (:props event) :organization-member-add-source)))
|
(t/is (not (contains? (:props event) :organization-member-add-source)))
|
||||||
(t/is (not (contains? (:props event) :belongs-to-team-on-add)))
|
(t/is (not (contains? (:props event) :belongs-to-team-on-add)))
|
||||||
(t/is (not (contains? (:props event) :organization-member-count-before)))
|
(t/is (not (contains? (:props event) :organization-member-count-before)))
|
||||||
@ -530,6 +537,10 @@
|
|||||||
(:origin @frontend-event)))
|
(:origin @frontend-event)))
|
||||||
(t/is (= organization-id
|
(t/is (= organization-id
|
||||||
(get-in @frontend-event [:props :organization-id])))
|
(get-in @frontend-event [:props :organization-id])))
|
||||||
|
(t/is (= (:id invitee)
|
||||||
|
(get-in @frontend-event [:props :user-id])))
|
||||||
|
(t/is (= (:id inviter)
|
||||||
|
(get-in @frontend-event [:props :user-who-send-invitation])))
|
||||||
(t/is (= "direct-organization-invitation"
|
(t/is (= "direct-organization-invitation"
|
||||||
(get-in @frontend-event [:props :organization-member-add-source])))
|
(get-in @frontend-event [:props :organization-member-add-source])))
|
||||||
(t/is (false? (get-in @frontend-event [:props :belongs-to-team-on-add])))
|
(t/is (false? (get-in @frontend-event [:props :belongs-to-team-on-add])))
|
||||||
@ -570,6 +581,9 @@
|
|||||||
(t/is (some #(= "accept-team-invitation-from" (:name %)) events))
|
(t/is (some #(= "accept-team-invitation-from" (:name %)) events))
|
||||||
(t/is (= (:id team) (get-in event [:props :team-id])))
|
(t/is (= (:id team) (get-in event [:props :team-id])))
|
||||||
(t/is (= organization-id (get-in event [:props :organization-id])))
|
(t/is (= organization-id (get-in event [:props :organization-id])))
|
||||||
|
(t/is (= (:id invitee) (get-in event [:props :user-id])))
|
||||||
|
(t/is (= (:id inviter)
|
||||||
|
(get-in event [:props :user-who-send-invitation])))
|
||||||
(t/is (not (contains? (:props event) :organization-member-add-source)))
|
(t/is (not (contains? (:props event) :organization-member-add-source)))
|
||||||
(t/is (not (contains? (:props event) :belongs-to-team-on-add)))
|
(t/is (not (contains? (:props event) :belongs-to-team-on-add)))
|
||||||
(t/is (not (contains? (:props event) :organization-member-count-before)))
|
(t/is (not (contains? (:props event) :organization-member-count-before)))
|
||||||
@ -578,6 +592,10 @@
|
|||||||
(t/is (= (:id team) (get-in @frontend-event [:props :team-id])))
|
(t/is (= (:id team) (get-in @frontend-event [:props :team-id])))
|
||||||
(t/is (= organization-id
|
(t/is (= organization-id
|
||||||
(get-in @frontend-event [:props :organization-id])))
|
(get-in @frontend-event [:props :organization-id])))
|
||||||
|
(t/is (= (:id invitee)
|
||||||
|
(get-in @frontend-event [:props :user-id])))
|
||||||
|
(t/is (= (:id inviter)
|
||||||
|
(get-in @frontend-event [:props :user-who-send-invitation])))
|
||||||
(t/is (= "team-invitation"
|
(t/is (= "team-invitation"
|
||||||
(get-in @frontend-event [:props :organization-member-add-source])))
|
(get-in @frontend-event [:props :organization-member-add-source])))
|
||||||
(t/is (true? (get-in @frontend-event [:props :belongs-to-team-on-add])))
|
(t/is (true? (get-in @frontend-event [:props :belongs-to-team-on-add])))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user