0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 07:50:43 -05:00

Add extra events info to track teams and invitations

This commit is contained in:
Alejandro Alonso 2024-06-27 13:44:24 +02:00 committed by Andrey Antukh
parent 40b43c6c5b
commit f6b367cdca
2 changed files with 15 additions and 9 deletions

View file

@ -867,7 +867,6 @@
:invitations invitations}
{::audit/props {:invitations (count invitations)}})))))
;; --- Mutation: Create Team & Invite Members
(def ^:private schema:create-team-with-invitations

View file

@ -147,7 +147,7 @@
(defmethod process-token :team-invitation
[{: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}]
(us/verify! ::team-invitation-claims claims)
@ -169,13 +169,20 @@
;; if we have logged-in user and it matches the invitation we proceed
;; with accepting the invitation and joining the current profile to the
;; invited team.
(let [profile (accept-invitation cfg claims invitation profile)]
(-> (assoc claims :state :created)
(rph/with-meta {::audit/name "accept-team-invitation"
::audit/profile-id (:id profile)
::audit/props {:team-id (:team-id claims)
:role (:role claims)
:invitation-id (:id invitation)}})))
(let [context (audit/params->context params)
props {:team-id (:team-id claims)
:role (:role claims)
:invitation-id (:id invitation)}]
(accept-invitation cfg claims invitation profile)
(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
:code :invalid-token