Fixing Duplicate tasks showing up after joining a challenge (#7787)

* fix: prevents double joining challenge by quickly hitting join button on challenge twice. fixes #7730

* Fixing client side parameter updates.
This commit is contained in:
Travis
2016-12-20 17:52:18 -08:00
committed by Keith Holliday
parent 92cbb4a07d
commit 55a8eef3e1
3 changed files with 8 additions and 3 deletions

View File

@@ -320,6 +320,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
*/
$scope.join = function (challenge) {
challenge._joiningInProgress = true;
Challenges.joinChallenge(challenge._id)
.then(function (response) {
User.user.challenges.push(challenge._id);
@@ -329,6 +330,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
.then(function (response) {
var tasks = response.data.data;
User.syncUserTasks(tasks);
challenge._joiningInProgress = false;
});
}