mirror of
https://github.com/penpot/penpot.git
synced 2025-01-06 14:50:20 -05:00
Merge pull request #5471 from penpot/niwinz-bugfix-5
🐛 Fix unhandled exception on accepting invitation
This commit is contained in:
commit
09c184200d
1 changed files with 18 additions and 15 deletions
|
@ -166,23 +166,26 @@
|
||||||
;; invited team.
|
;; invited team.
|
||||||
(let [props {:team-id (:team-id claims)
|
(let [props {:team-id (:team-id claims)
|
||||||
:role (:role claims)
|
:role (:role claims)
|
||||||
:invitation-id (:id invitation)}
|
:invitation-id (:id invitation)}]
|
||||||
|
|
||||||
accept-invitation-event
|
(audit/submit!
|
||||||
(-> (audit/event-from-rpc-params params)
|
cfg
|
||||||
(assoc ::audit/name "accept-team-invitation")
|
(-> (audit/event-from-rpc-params params)
|
||||||
(assoc ::audit/props props))
|
(assoc ::audit/name "accept-team-invitation")
|
||||||
|
(assoc ::audit/props props)))
|
||||||
|
|
||||||
accept-invitation-from-event
|
;; NOTE: Backward compatibility; old invitations can
|
||||||
(-> (audit/event-from-rpc-params params)
|
;; have the `created-by` to be nil; so in this case we
|
||||||
(assoc ::audit/profile-id (:created-by invitation))
|
;; don't submit this event to the audit-log
|
||||||
(assoc ::audit/name "accept-team-invitation-from")
|
(when-let [created-by (:created-by invitation)]
|
||||||
(assoc ::audit/props (assoc props
|
(audit/submit!
|
||||||
:profile-id (:id profile)
|
cfg
|
||||||
:email (:email profile))))]
|
(-> (audit/event-from-rpc-params params)
|
||||||
|
(assoc ::audit/profile-id created-by)
|
||||||
(audit/submit! cfg accept-invitation-event)
|
(assoc ::audit/name "accept-team-invitation-from")
|
||||||
(audit/submit! cfg accept-invitation-from-event)
|
(assoc ::audit/props (assoc props
|
||||||
|
:profile-id (:id profile)
|
||||||
|
:email (:email profile))))))
|
||||||
|
|
||||||
(accept-invitation cfg claims invitation profile)
|
(accept-invitation cfg claims invitation profile)
|
||||||
(assoc claims :state :created))
|
(assoc claims :state :created))
|
||||||
|
|
Loading…
Reference in a new issue