mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-04 13:09:41 +00:00
Merge pull request #2311 from colegleason/add-challenge-user
Add challenge to user.challenges on creation. Fixes #2310
This commit is contained in:
commit
6a61dd0740
1 changed files with 5 additions and 0 deletions
|
|
@ -82,6 +82,11 @@ ChallengeSchema.methods.syncToUser = function(user, cb) {
|
|||
var self = this;
|
||||
self.shortName = self.shortName || self.name;
|
||||
|
||||
// Add challenge to user.challenges
|
||||
if (!_.contains(user.challenges, self._id)) {
|
||||
user.challenges.push(self._id);
|
||||
}
|
||||
|
||||
// Sync tags
|
||||
var tags = user.tags || [];
|
||||
var i = _.findIndex(tags, {id: self._id})
|
||||
|
|
|
|||
Loading…
Reference in a new issue