From d18f42fe7ae26a9f79ab10a3d73dceaffd7ef777 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Mon, 20 Jun 2016 06:35:21 -0500 Subject: [PATCH] fix(client): Use $state on $rootScope --- website/client/js/services/userServices.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/client/js/services/userServices.js b/website/client/js/services/userServices.js index 21d024e9a7..1012ff7b7d 100644 --- a/website/client/js/services/userServices.js +++ b/website/client/js/services/userServices.js @@ -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');