mirror of
https://github.com/penpot/penpot.git
synced 2026-07-28 17:06:21 +00:00
✨ Cancel subscription when user deletes account
This commit is contained in:
parent
3d2a5a2957
commit
785ab53f8c
@ -301,14 +301,14 @@
|
||||
org))
|
||||
orgs)))
|
||||
|
||||
(defn- delete-owned-orgs-api
|
||||
(defn- cleanup-deleted-penpot-user-api
|
||||
[cfg {:keys [profile-id] :as params}]
|
||||
(let [baseuri (cf/get :nitrate-backend-uri)]
|
||||
(request-to-nitrate cfg :post
|
||||
(str baseuri
|
||||
"/api/users/"
|
||||
profile-id
|
||||
"/delete-owned-organizations")
|
||||
"/cleanup-after-deletion")
|
||||
nil params)))
|
||||
|
||||
(defn- set-team-org-api
|
||||
@ -352,16 +352,6 @@
|
||||
"/remove-user")
|
||||
nil params)))
|
||||
|
||||
(defn- remove-profile-from-all-orgs-api
|
||||
[cfg {:keys [profile-id] :as params}]
|
||||
(let [baseuri (cf/get :nitrate-backend-uri)]
|
||||
(request-to-nitrate cfg :post
|
||||
(str baseuri
|
||||
"/api/users/"
|
||||
profile-id
|
||||
"/remove-organizations")
|
||||
nil params)))
|
||||
|
||||
(defn- remove-team-from-org-api
|
||||
[cfg {:keys [team-id organization-id] :as params}]
|
||||
(let [baseuri (cf/get :nitrate-backend-uri)
|
||||
@ -469,10 +459,9 @@
|
||||
:get-owned-orgs (partial get-owned-orgs-api cfg)
|
||||
:get-owned-orgs-summary (partial get-owned-orgs-summary-api cfg)
|
||||
:get-org-members (partial get-org-members-api cfg)
|
||||
:delete-owned-orgs (partial delete-owned-orgs-api cfg)
|
||||
:cleanup-deleted-penpot-user (partial cleanup-deleted-penpot-user-api cfg)
|
||||
:add-profile-to-org (partial add-profile-to-org-api cfg)
|
||||
:remove-profile-from-org (partial remove-profile-from-org-api cfg)
|
||||
:remove-profile-from-all-orgs (partial remove-profile-from-all-orgs-api cfg)
|
||||
:get-org-permissions (partial get-org-permissions-api cfg)
|
||||
:delete-team (partial delete-team-api cfg)
|
||||
:remove-team-from-org (partial remove-team-from-org-api cfg)
|
||||
|
||||
@ -496,10 +496,11 @@
|
||||
;; (during delete-owned-orgs) and ::notify-organization-deletion.
|
||||
;; Both preserve org teams unchanged and only prefix or delete
|
||||
;; imported "Your Penpot" teams according to whether they still have files.
|
||||
;; Let Nitrate clean up the data associated with the deleted Penpot user:
|
||||
;; owned organizations, remaining memberships, and subscription cancellation.
|
||||
(when (contains? cf/flags :nitrate)
|
||||
(nitrate/call cfg :delete-owned-orgs {:profile-id profile-id})
|
||||
;; Remove the user from any remaining org memberships.
|
||||
(nitrate/call cfg :remove-profile-from-all-orgs {:profile-id profile-id}))
|
||||
(nitrate/call cfg :cleanup-deleted-penpot-user
|
||||
{:profile-id profile-id}))
|
||||
|
||||
;; Schedule cascade deletion to a worker
|
||||
(wrk/submit! {::db/conn conn
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user