mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Make user sync after accepting or rejecting a quest
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
])
|
||||
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user