diff --git a/website/public/js/controllers/groupsCtrl.js b/website/public/js/controllers/groupsCtrl.js index 7ef422ea98..e9cb113d20 100644 --- a/website/public/js/controllers/groupsCtrl.js +++ b/website/public/js/controllers/groupsCtrl.js @@ -501,6 +501,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' .controller("PartyCtrl", ['$rootScope','$scope', 'Groups', 'User', 'Challenges', '$state', '$compile', function($rootScope,$scope, Groups, User, Challenges, $state, $compile) { + $scope.type = 'party'; $scope.text = window.env.t('party'); $scope.group = $rootScope.party = Groups.party(); @@ -579,6 +580,23 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' $rootScope.party.$questAbort(); } + $scope.questAccept = function(party){ + party.$questAccept() + .then(function(res) { + User.sync(); + }, function(err) { + console.log(err); + }); + } + + $scope.questReject = function(party){ + party.$questReject() + .then(function(res) { + User.sync(); + }, function(err) { + console.log(err); + }); + } } ]) diff --git a/website/public/js/controllers/notificationCtrl.js b/website/public/js/controllers/notificationCtrl.js index f53a409e78..17ea1774ed 100644 --- a/website/public/js/controllers/notificationCtrl.js +++ b/website/public/js/controllers/notificationCtrl.js @@ -150,7 +150,7 @@ habitrpg.controller('NotificationCtrl', // Quest invitation modal $rootScope.$watch('user.party.quest.RSVPNeeded', function(after, before){ if (after != true) return; - $rootScope.openModal('questInvitation'); + $rootScope.openModal('questInvitation', {controller:'PartyCtrl'}); }); $rootScope.$on('responseError', function(ev, error){ diff --git a/website/views/shared/modals/quests.jade b/website/views/shared/modals/quests.jade index 0a6692525f..ab1f6c781f 100644 --- a/website/views/shared/modals/quests.jade +++ b/website/views/shared/modals/quests.jade @@ -87,5 +87,5 @@ script(type='text/ng-template', id='modals/questInvitation.html') quest-rewards(key='{{::user.party.quest.key}}', header=env.t('rewards')) .modal-footer button.btn.btn-default(ng-click='questHold = true; $close()')=env.t('askLater') - button.btn.btn-default(ng-click='party.$questReject(); $close()')=env.t('reject') - button.btn.btn-primary(ng-click='party.$questAccept(); $close()')=env.t('accept') + button.btn.btn-default(ng-click='questReject(party); $close()')=env.t('reject') + button.btn.btn-primary(ng-click='questAccept(party); $close()')=env.t('accept')