mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
remove need to refresh after having accepted party invite
This commit is contained in:
@@ -173,7 +173,8 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
|||||||
$scope.join = function(party){
|
$scope.join = function(party){
|
||||||
var group = new Groups.Group({_id: party.id, name: party.name});
|
var group = new Groups.Group({_id: party.id, name: party.name});
|
||||||
// there a better way to access GroupsCtrl.groups.party?
|
// there a better way to access GroupsCtrl.groups.party?
|
||||||
Groups.groups.party = group.$join(function(){
|
group.$join(function(party){
|
||||||
|
$scope.group = party;
|
||||||
User.user.invitations.party = undefined;
|
User.user.invitations.party = undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,6 +247,10 @@ api.join = function(req, res, next) {
|
|||||||
}
|
}
|
||||||
], function(err, results){
|
], function(err, results){
|
||||||
if (err) return res.json(500,{err:err});
|
if (err) return res.json(500,{err:err});
|
||||||
|
|
||||||
|
// Remove self from party (see above failing `match` directive in `populate`
|
||||||
|
if(results[1].type == 'party') removeSelf(results[1], user);
|
||||||
|
|
||||||
res.json(results[1]);
|
res.json(results[1]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user