fix: Prevent message from displaying if no new messages exist

This commit is contained in:
Blade Barringer
2016-06-19 08:38:07 -05:00
parent b62fbab6f8
commit 941ff10cdc
2 changed files with 5 additions and 6 deletions
+3 -3
View File
@@ -14,8 +14,8 @@ angular.module('habitrpg')
/**
* Services that persists and retrieves user from localStorage.
*/
.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) {
.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) {
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 ($rootScope.$state && $rootScope.$state.current.name=='options.social.inbox') {
if ($state.current.name=='options.social.inbox' && user.inbox.newMessages > 0) {
userServices.clearNewMessages();
}
$rootScope.$emit('userSynced');