mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-05-24 06:35:37 +00:00
fix(client): Use $state on $rootScope
This commit is contained in:
parent
94ddd82cae
commit
d18f42fe7a
1 changed files with 3 additions and 3 deletions
|
|
@ -14,8 +14,8 @@ angular.module('habitrpg')
|
|||
/**
|
||||
* Services that persists and retrieves user from localStorage.
|
||||
*/
|
||||
.factory('User', ['$rootScope', '$http', '$location', '$window', '$state', 'STORAGE_USER_ID', 'STORAGE_SETTINGS_ID', 'Notification', 'ApiUrl', 'Tasks', 'Tags', 'Content', 'UserNotifications',
|
||||
function($rootScope, $http, $location, $window, $state, STORAGE_USER_ID, STORAGE_SETTINGS_ID, Notification, ApiUrl, Tasks, Tags, Content, UserNotifications) {
|
||||
.factory('User', ['$rootScope', '$http', '$location', '$window', 'STORAGE_USER_ID', 'STORAGE_SETTINGS_ID', 'Notification', 'ApiUrl', 'Tasks', 'Tags', 'Content', 'UserNotifications',
|
||||
function($rootScope, $http, $location, $window, STORAGE_USER_ID, STORAGE_SETTINGS_ID, Notification, ApiUrl, Tasks, Tags, Content, UserNotifications) {
|
||||
var authenticated = false;
|
||||
var defaultSettings = {
|
||||
auth: { apiId: '', apiToken: ''},
|
||||
|
|
@ -106,7 +106,7 @@ angular.module('habitrpg')
|
|||
.then(function (response) {
|
||||
var tasks = response.data.data;
|
||||
syncUserTasks(tasks);
|
||||
if ($state.current.name=='options.social.inbox' && user.inbox.newMessages > 0) {
|
||||
if ($rootScope.$state && $rootScope.$state.current.name=='options.social.inbox' && user.inbox.newMessages > 0) {
|
||||
userServices.clearNewMessages();
|
||||
}
|
||||
$rootScope.$emit('userSynced');
|
||||
|
|
|
|||
Loading…
Reference in a new issue