Api v3 party quest fixes (#7341)

* Fix display of add challenge message when group challenges are empty

* Fixed forced quest start to update quest without reload

* Fixed needing to reload when accepting party invite

* Fix group leave and join reload

* Fixed leave current party and join another

* Updated party tests
This commit is contained in:
Keith Holliday
2016-05-18 10:22:32 +01:00
committed by Matteo Pagliazzi
parent 7ac67315e6
commit 1a87619bac
8 changed files with 35 additions and 25 deletions

View File

@@ -56,6 +56,8 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
$scope.join = function (party) {
Groups.Group.join(party.id)
.then(function (response) {
$scope.group = response.data.data;
User.sync();
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'join group','owner':false,'groupType':'party','privacy':'private'});
Analytics.updateUser({'partyID': party.id});
$rootScope.hardRedirect('/#/options/groups/party');
@@ -131,12 +133,13 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
$scope.leaveOldPartyAndJoinNewParty = function(newPartyId, newPartyName) {
if (confirm('Are you sure you want to delete your party and join ' + newPartyName + '?')) {
Groups.Group.leave({gid: Groups.party()._id, keep: false}, undefined, function() {
$scope.group = {
loadingNewParty: true
};
$scope.join({ id: newPartyId, name: newPartyName });
});
Groups.Group.leave(Groups.data.party._id, false)
.then(function() {
$scope.group = {
loadingNewParty: true
};
$scope.join({ id: newPartyId, name: newPartyName });
});
}
}
@@ -183,6 +186,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
$scope.questForceStart = function(){
Quests.sendAction('quests/force-start')
.then(function(quest) {
console.log(quest)
$scope.group.quest = quest;
});
};