Skip to content

Commit 6995dc0

Browse files
committed
fix(controllers): separate vip and pocket users action on delete
1 parent b88dc9d commit 6995dc0

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/v3/controllers/admin_controller.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,13 @@ export const userRemoveCongregation = async (req: Request, res: Response) => {
856856

857857
const userCong = user.profile.congregation?.id;
858858

859-
await user.removeCongregation();
859+
if (user.profile.role === 'vip') {
860+
await user.removeCongregation();
861+
}
862+
863+
if (user.profile.role === 'pocket') {
864+
await UsersList.delete(user.id);
865+
}
860866

861867
if (userCong) {
862868
const cong = CongregationsList.findById(userCong);

src/v3/controllers/congregation_admin_controller.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,13 @@ export const congregationDeleteUser = async (req: Request, res: Response) => {
726726
return;
727727
}
728728

729-
await foundUser.removeCongregation();
729+
if (foundUser.profile.role === 'vip') {
730+
await foundUser.removeCongregation();
731+
}
732+
733+
if (foundUser.profile.role === 'pocket') {
734+
await UsersList.delete(foundUser.id);
735+
}
730736

731737
const cong_members = cong.getMembers(req.signedCookies.visitorid);
732738

0 commit comments

Comments
 (0)