mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Allow leaving a challenge without having access to the challenge (e.g. after leaving a party or guild)
This commit is contained in:
@@ -190,9 +190,6 @@ api.leaveChallenge = {
|
||||
let challenge = await Challenge.findOne({ _id: req.params.challengeId }).exec();
|
||||
if (!challenge) throw new NotFound(res.t('challengeNotFound'));
|
||||
|
||||
let group = await Group.getGroup({user, groupId: challenge.group, fields: '_id type privacy'});
|
||||
if (!group || !challenge.canView(user, group)) throw new NotFound(res.t('challengeNotFound'));
|
||||
|
||||
if (!challenge.isMember(user)) throw new NotAuthorized(res.t('challengeMemberNotFound'));
|
||||
|
||||
// Unlink challenge's tasks from user's tasks and save the challenge
|
||||
|
||||
Reference in New Issue
Block a user