(core) Delete my account button

Summary:
Adding new "Delete my account" button to the profile page that allows users to remove completely
their accounts as long as they don't own any team site.

Test Plan: Added

Reviewers: georgegevoian, paulfitz

Reviewed By: georgegevoian, paulfitz

Subscribers: paulfitz

Differential Revision: https://phab.getgrist.com/D4037
This commit is contained in:
Jarosław Sadziński
2023-09-26 10:09:06 +02:00
parent e033889b6a
commit cce185956c
19 changed files with 205 additions and 34 deletions

View File

@@ -177,7 +177,7 @@ export class ApiServer {
return sendReply(req, res, query);
}));
// // DELETE /api/orgs/:oid
// DELETE /api/orgs/:oid
// Delete the specified org and all included workspaces and docs.
this._app.delete('/api/orgs/:oid', expressWrap(async (req, res) => {
const org = getOrgKey(req);

View File

@@ -837,7 +837,7 @@ export class HomeDBManager extends EventEmitter {
}
await this._connection.transaction(async manager => {
const user = await manager.findOne(User, {where: {id: userIdToDelete},
relations: ["logins", "personalOrg"]});
relations: ["logins", "personalOrg", "prefs"]});
if (!user) { throw new ApiError('user not found', 404); }
if (name) {
if (user.name !== name) {
@@ -853,6 +853,7 @@ export class HomeDBManager extends EventEmitter {
.from('group_users')
.where('user_id = :userId', {userId: userIdToDelete})
.execute();
await manager.delete(User, userIdToDelete);
});
return {