mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-20 20:58:51 +00:00
Merge branch 'release' into develop
This commit is contained in:
commit
e9845e7b01
5 changed files with 13 additions and 7 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "habitica",
|
||||
"version": "5.1.1",
|
||||
"version": "5.1.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "habitica",
|
||||
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
|
||||
"version": "5.1.1",
|
||||
"version": "5.1.2",
|
||||
"main": "./website/server/index.js",
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.22.5",
|
||||
|
|
|
|||
|
|
@ -270,6 +270,9 @@ export default {
|
|||
methods: {
|
||||
percent,
|
||||
showMemberModal (member) {
|
||||
if (this.$route.name === 'userProfile' && this.$route.params?.userId === member._id) {
|
||||
return;
|
||||
}
|
||||
this.$router.push({ name: 'userProfile', params: { userId: member._id } });
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -575,13 +575,15 @@ api.getChallenge = {
|
|||
|
||||
// Fetching basic group data
|
||||
const group = await Group.getGroup({
|
||||
user, groupId: challenge.group, fields: `${basicGroupFields} purchased`, optionalMembership: true,
|
||||
user, groupId: challenge.group, fields: `${basicGroupFields} purchased`,
|
||||
});
|
||||
if (!group || !challenge.canView(user, group)) throw new NotFound(res.t('challengeNotFound'));
|
||||
group.purchased = undefined;
|
||||
|
||||
if (!group && !challenge.canView(user, group)) throw new NotFound(res.t('challengeNotFound'));
|
||||
const chalRes = challenge.toJSON();
|
||||
chalRes.group = group.toJSON({ minimize: true });
|
||||
if (group) {
|
||||
group.purchased = undefined;
|
||||
chalRes.group = group.toJSON({ minimize: true });
|
||||
}
|
||||
|
||||
// Instead of populate we make a find call manually because of https://github.com/Automattic/mongoose/issues/3833
|
||||
const chalLeader = await User.findById(chalRes.leader).select(nameFields).exec();
|
||||
chalRes.leader = chalLeader ? chalLeader.toJSON({ minimize: true }) : null;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ schema.methods.canModify = function canModifyChallenge (user) {
|
|||
schema.methods.canJoin = function canJoinChallenge (user, group) {
|
||||
// for when leader has left private group that contains the challenge
|
||||
if (this.isLeader(user)) return true;
|
||||
if (!group) return false;
|
||||
if (group.type === 'guild' && group.privacy === 'public') {
|
||||
return group._id === TAVERN_ID;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue