mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
v3: misc fixes
This commit is contained in:
@@ -40,6 +40,9 @@ angular.module('habitrpg')
|
|||||||
} else {
|
} else {
|
||||||
$rootScope.$broadcast('responseError', response.data.message);
|
$rootScope.$broadcast('responseError', response.data.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($rootScope.User && $rootScope.User.sync) $rootScope.User.sync();
|
||||||
|
|
||||||
// Need to reject the prompse so the error is handled correctly
|
// Need to reject the prompse so the error is handled correctly
|
||||||
if (response.status === 401) {
|
if (response.status === 401) {
|
||||||
return $q.reject(response);
|
return $q.reject(response);
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
|||||||
if ($state.is('options.social.party')) {
|
if ($state.is('options.social.party')) {
|
||||||
Groups.Group.syncParty()
|
Groups.Group.syncParty()
|
||||||
.then(function successCallback(group) {
|
.then(function successCallback(group) {
|
||||||
$scope.group = group;
|
$rootScope.party = $scope.group = group;
|
||||||
checkForNotifications();
|
checkForNotifications();
|
||||||
}, function errorCallback(response) {
|
}, function errorCallback(response) {
|
||||||
$scope.group = $scope.newGroup = { type: 'party' };
|
$rootScope.party = $scope.group = $scope.newGroup = { type: 'party' };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
|||||||
if (!group.name) group.name = env.t('possessiveParty', {name: User.user.profile.name});
|
if (!group.name) group.name = env.t('possessiveParty', {name: User.user.profile.name});
|
||||||
Groups.Group.create(group)
|
Groups.Group.create(group)
|
||||||
.then(function(response) {
|
.then(function(response) {
|
||||||
$scope.group = response.data.data;
|
$rootScope.party = $scope.group = response.data.data;
|
||||||
User.sync();
|
User.sync();
|
||||||
Groups.data.party = $scope.group;
|
Groups.data.party = $scope.group;
|
||||||
Analytics.track({'hitType':'event', 'eventCategory':'behavior', 'eventAction':'join group', 'owner':true, 'groupType':'party', 'privacy':'private'});
|
Analytics.track({'hitType':'event', 'eventCategory':'behavior', 'eventAction':'join group', 'owner':true, 'groupType':'party', 'privacy':'private'});
|
||||||
@@ -56,7 +56,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
|||||||
$scope.join = function (party) {
|
$scope.join = function (party) {
|
||||||
Groups.Group.join(party.id)
|
Groups.Group.join(party.id)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
$scope.group = response.data.data;
|
$rootScope.party = $scope.group = response.data.data;
|
||||||
User.sync();
|
User.sync();
|
||||||
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'join group','owner':false,'groupType':'party','privacy':'private'});
|
Analytics.track({'hitType':'event','eventCategory':'behavior','eventAction':'join group','owner':false,'groupType':'party','privacy':'private'});
|
||||||
Analytics.updateUser({'partyID': party.id});
|
Analytics.updateUser({'partyID': party.id});
|
||||||
@@ -135,7 +135,7 @@ habitrpg.controller("PartyCtrl", ['$rootScope','$scope','Groups','Chat','User','
|
|||||||
if (confirm('Are you sure you want to delete your party and join ' + newPartyName + '?')) {
|
if (confirm('Are you sure you want to delete your party and join ' + newPartyName + '?')) {
|
||||||
Groups.Group.leave(Groups.data.party._id, false)
|
Groups.Group.leave(Groups.data.party._id, false)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
$scope.group = {
|
$rootScope.party = $scope.group = {
|
||||||
loadingNewParty: true
|
loadingNewParty: true
|
||||||
};
|
};
|
||||||
$scope.join({ id: newPartyId, name: newPartyName });
|
$scope.join({ id: newPartyId, name: newPartyName });
|
||||||
|
|||||||
@@ -292,8 +292,8 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
} else if (spell.target == 'tasks') {
|
} else if (spell.target == 'tasks') {
|
||||||
var tasks = User.user.habits.concat(User.user.dailys).concat(User.user.rewards).concat(User.user.todos);
|
var tasks = User.user.habits.concat(User.user.dailys).concat(User.user.rewards).concat(User.user.todos);
|
||||||
// exclude challenge tasks
|
// exclude challenge tasks
|
||||||
tasks = tasks.filter(function (t) {
|
tasks = tasks.filter(function (task) {
|
||||||
if (!t.challenge) return true;
|
if (!task.challenge) return true;
|
||||||
return (!task.challenge.id || task.challenge.broken);
|
return (!task.challenge.id || task.challenge.broken);
|
||||||
});
|
});
|
||||||
$scope.castEnd(tasks, 'tasks');
|
$scope.castEnd(tasks, 'tasks');
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ api.checkout = {
|
|||||||
// sku: 1,
|
// sku: 1,
|
||||||
price: amount,
|
price: amount,
|
||||||
currency: 'USD',
|
currency: 'USD',
|
||||||
quality: 1,
|
quantity: 1,
|
||||||
}],
|
}],
|
||||||
},
|
},
|
||||||
amount: {
|
amount: {
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ nav.toolbar(ng-controller='MenuCtrl')
|
|||||||
span.glyphicon.glyphicon-plus-sign
|
span.glyphicon.glyphicon-plus-sign
|
||||||
span=env.t('haveUnallocated', {points: '{{user.stats.points}}'})
|
span=env.t('haveUnallocated', {points: '{{user.stats.points}}'})
|
||||||
li(ng-repeat='(k,v) in user.newMessages', ng-if='v.value')
|
li(ng-repeat='(k,v) in user.newMessages', ng-if='v.value')
|
||||||
a(ng-click='k === party._id ? $state.go("options.social.party") : $state.go("options.social.guilds.detail",{gid:k}); ', data-close-menu)
|
a(ng-click='(k === party._id || k === user.party._id) ? $state.go("options.social.party") : $state.go("options.social.guilds.detail",{gid:k}); ', data-close-menu)
|
||||||
span.glyphicon.glyphicon-comment
|
span.glyphicon.glyphicon-comment
|
||||||
span {{v.name}}
|
span {{v.name}}
|
||||||
a(ng-click='clearMessages(k)', popover=env.t('clear'),popover-placement='right',popover-trigger='mouseenter',popover-append-to-body='true')
|
a(ng-click='clearMessages(k)', popover=env.t('clear'),popover-placement='right',popover-trigger='mouseenter',popover-append-to-body='true')
|
||||||
|
|||||||
Reference in New Issue
Block a user