Compare commits

...

3 Commits

Author SHA1 Message Date
Andrey Antukh
384ad2e6fa
Merge pull request #4813 from penpot/superalex-tracking-teams-and-invitations-in-posthog
 Add extra events info to track teams and invitations
2024-06-28 11:08:30 +02:00
Andrey Antukh
c090a11e5b Normalize audit event origin tracking on frontend and backend 2024-06-28 10:30:26 +02:00
Alejandro Alonso
f6b367cdca Add extra events info to track teams and invitations 2024-06-28 10:30:26 +02:00
3 changed files with 16 additions and 10 deletions

View File

@ -91,7 +91,7 @@
[params]
(d/without-nils
{:external-session-id (::rpc/external-session-id params)
:triggered-by (::rpc/handler-name params)}))
:event-origin (::rpc/handler-name params)}))
;; --- SPECS

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