mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
Fixed quest drop modal (#7377)
* Fixed quest drop modal * Fixed broken party test
This commit is contained in:
committed by
Matteo Pagliazzi
parent
d36c514c06
commit
f4ca97ffc3
@@ -51,7 +51,9 @@ describe("Party Controller", function() {
|
||||
var syncParty = sinon.stub(groups.Group, 'syncParty')
|
||||
syncParty.returns(Promise.resolve(groupResponse));
|
||||
$controller('PartyCtrl', { $scope: scope, $state: state, User: User });
|
||||
expect(state.is).to.be.calledOnce; // ensure initialization worked as desired
|
||||
// @TODO: I have update the party ctrl to sync the user whenever it is called rather than only on the party page
|
||||
// Since I have cached the promise, this should not be a performance issue, but let's keep this test here in case anything breaks.
|
||||
// expect(state.is).to.be.calledOnce; // ensure initialization worked as desired
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
||||
$scope.inviteOrStartParty = Groups.inviteOrStartParty;
|
||||
$scope.loadWidgets = Social.loadWidgets;
|
||||
|
||||
if ($state.is('options.social.party')) {
|
||||
Groups.Group.syncParty()
|
||||
.then(function successCallback(group) {
|
||||
$rootScope.party = $scope.group = group;
|
||||
@@ -19,7 +18,6 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
||||
}, function errorCallback(response) {
|
||||
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
|
||||
});
|
||||
}
|
||||
|
||||
function checkForNotifications () {
|
||||
// Checks if user's party has reached 2 players for the first time.
|
||||
@@ -148,6 +146,15 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
||||
User.set({'invitations.party':{}});
|
||||
}
|
||||
|
||||
$scope.questInit = function() {
|
||||
var key = $rootScope.selectedQuest.key;
|
||||
|
||||
Quests.initQuest(key).then(function() {
|
||||
$rootScope.selectedQuest = undefined;
|
||||
$scope.$close();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.questCancel = function(){
|
||||
if (!confirm(window.env.t('sureCancel'))) return;
|
||||
|
||||
|
||||
@@ -104,7 +104,8 @@ script(type='text/ng-template', id='modals/questDrop.html')
|
||||
.quest-icon(class='inventory_quest_scroll_{{::selectedQuest.key}}')
|
||||
h4!=env.t('leveledUpReceivedQuest', {level:'{{user.stats.lvl}}'})
|
||||
.row(style='margin-top:2em')
|
||||
button.btn.btn-primary(ng-click='inviteOrStartParty(group); $close()', ng-if='!party.members')=env.t('startAParty')
|
||||
button.btn.btn-primary(ng-click='inviteOrStartParty(party); $close()', ng-if='!User.user.party._id')=env.t('startAParty')
|
||||
button.btn.btn-primary(ng-click='inviteOrStartParty(party); $close()', ng-if='!User.user.party._id && !party.members')=env.t('battleWithFriends')
|
||||
button.btn.btn-primary(ng-click='questInit(); $close()', ng-if='party.members')=env.t('inviteParty')
|
||||
button.btn.btn-default(ng-click='closeQuest(); $close()')=env.t('questLater')
|
||||
.modal-footer(style='margin-top:0', ng-init='loadWidgets()')
|
||||
|
||||
Reference in New Issue
Block a user