diff --git a/test/spec/services/questServicesSpec.js b/test/spec/services/questServicesSpec.js index 379d321b32..ef5f93e7ce 100644 --- a/test/spec/services/questServicesSpec.js +++ b/test/spec/services/questServicesSpec.js @@ -97,7 +97,7 @@ describe('Quests Service', function() { expect(rootScope.openModal).to.have.been.notCalled; }); - it('opens purchase modal if all prerequisites are met', function() { + it('opens purchase modal if Gem quest prerequisites are met', function() { user.stats.lvl = 100; user.achievements.quests.atom1 = 2; @@ -108,11 +108,12 @@ describe('Quests Service', function() { expect(rootScope.openModal).to.have.been.calledWith('buyQuest'); }); - it('calls user ops buyQuest if quest is Gold-purchasable', function() { + it('opens purchase modal if quest is Gold-purchasable', function() { questsService.buyQuest('dilatoryDistress1'); - expect(user.ops.buyQuest).to.have.been.calledOnce; - expect(rootScope.openModal).to.have.been.notCalled; + expect(scope.selectedQuest).to.eql(content.quests.dilatoryDistress1); + expect(rootScope.openModal).to.have.been.calledOnce; + expect(rootScope.openModal).to.have.been.calledWith('buyQuest'); }); }); }); diff --git a/website/public/js/services/questServices.js b/website/public/js/services/questServices.js index b634e0ace4..1ca6995c38 100644 --- a/website/public/js/services/questServices.js +++ b/website/public/js/services/questServices.js @@ -38,9 +38,6 @@ if (item.lvl && item.lvl > user.stats.lvl) { return alert(window.env.t('mustLvlQuest', {level: item.lvl})); } - if (item.category === 'gold') { - return User.user.ops.buyQuest({params:{key:item.key}}); - } $rootScope.selectedQuest = item; $rootScope.openModal('buyQuest', {controller:'InventoryCtrl'}); } diff --git a/website/views/shared/modals/quests.jade b/website/views/shared/modals/quests.jade index ab1f6c781f..0b16006351 100644 --- a/website/views/shared/modals/quests.jade +++ b/website/views/shared/modals/quests.jade @@ -62,7 +62,8 @@ script(type='text/ng-template', id='modals/buyQuest.html') quest-rewards(key='{{::selectedQuest.key}}', header=env.t('rewards')) .modal-footer button.btn.btn-default(ng-click='closeQuest(); $close()')=env.t('neverMind') - button.btn.btn-primary(ng-click='purchase("quests", quest); closeQuest(); $close()')=env.t('buyQuest') + button.btn.btn-primary(ng-if='::selectedQuest.category !== "gold"', ng-click='purchase("quests", quest); closeQuest(); $close()')=env.t('buyQuest') + ': {{::selectedQuest.value}} ' + env.t('gems') + button.btn.btn-primary(ng-if='::selectedQuest.category === "gold"', ng-click='user.ops.buyQuest({params:{key:selectedQuest.key}}); closeQuest(); $close()')=env.t('buyQuest') + ': {{::selectedQuest.goldValue}} ' + env.t('gold') script(type='text/ng-template', id='modals/questInvitation.html') .modal-header