0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 08:20:45 -05:00

Merge pull request #4813 from penpot/superalex-tracking-teams-and-invitations-in-posthog

 Add extra events info to track teams and invitations
This commit is contained in:
Andrey Antukh 2024-06-28 11:08:30 +02:00 committed by GitHub
commit 384ad2e6fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 10 deletions

View file

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

View file

@ -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

View file

@ -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