mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05:00
✨ Add extra events info to track teams and invitations
This commit is contained in:
parent
40b43c6c5b
commit
f6b367cdca
2 changed files with 15 additions and 9 deletions
|
@ -867,7 +867,6 @@
|
||||||
:invitations invitations}
|
:invitations invitations}
|
||||||
{::audit/props {:invitations (count invitations)}})))))
|
{::audit/props {:invitations (count invitations)}})))))
|
||||||
|
|
||||||
|
|
||||||
;; --- Mutation: Create Team & Invite Members
|
;; --- Mutation: Create Team & Invite Members
|
||||||
|
|
||||||
(def ^:private schema:create-team-with-invitations
|
(def ^:private schema:create-team-with-invitations
|
||||||
|
|
|
@ -147,7 +147,7 @@
|
||||||
|
|
||||||
(defmethod process-token :team-invitation
|
(defmethod process-token :team-invitation
|
||||||
[{:keys [conn] :as cfg}
|
[{:keys [conn] :as cfg}
|
||||||
{:keys [::rpc/profile-id token]}
|
{:keys [::rpc/profile-id token] :as params}
|
||||||
{:keys [member-id team-id member-email] :as claims}]
|
{:keys [member-id team-id member-email] :as claims}]
|
||||||
|
|
||||||
(us/verify! ::team-invitation-claims claims)
|
(us/verify! ::team-invitation-claims claims)
|
||||||
|
@ -169,13 +169,20 @@
|
||||||
;; if we have logged-in user and it matches the invitation we proceed
|
;; if we have logged-in user and it matches the invitation we proceed
|
||||||
;; with accepting the invitation and joining the current profile to the
|
;; with accepting the invitation and joining the current profile to the
|
||||||
;; invited team.
|
;; invited team.
|
||||||
(let [profile (accept-invitation cfg claims invitation profile)]
|
(let [context (audit/params->context params)
|
||||||
(-> (assoc claims :state :created)
|
props {:team-id (:team-id claims)
|
||||||
(rph/with-meta {::audit/name "accept-team-invitation"
|
:role (:role claims)
|
||||||
::audit/profile-id (:id profile)
|
:invitation-id (:id invitation)}]
|
||||||
::audit/props {:team-id (:team-id claims)
|
|
||||||
:role (:role claims)
|
(accept-invitation cfg claims invitation profile)
|
||||||
:invitation-id (:id invitation)}})))
|
(audit/submit! cfg
|
||||||
|
{::audit/type "action"
|
||||||
|
::audit/name "accept-team-invitation"
|
||||||
|
::audit/profile-id profile-id
|
||||||
|
::audit/props props
|
||||||
|
::audit/context context})
|
||||||
|
|
||||||
|
(assoc claims :state :created))
|
||||||
|
|
||||||
(ex/raise :type :validation
|
(ex/raise :type :validation
|
||||||
:code :invalid-token
|
:code :invalid-token
|
||||||
|
|
Loading…
Reference in a new issue