mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
fix: Prevent message from displaying if no new messages exist
This commit is contained in:
@@ -22,8 +22,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||||||
$rootScope.pageTitle = $state.current.title;
|
$rootScope.pageTitle = $state.current.title;
|
||||||
|
|
||||||
if (!!fromState.name) Analytics.track({'hitType':'pageview','eventCategory':'navigation','eventAction':'navigate','page':'/#/'+toState.name});
|
if (!!fromState.name) Analytics.track({'hitType':'pageview','eventCategory':'navigation','eventAction':'navigate','page':'/#/'+toState.name});
|
||||||
// clear inbox when entering inbox tab
|
if (toState.name=='options.social.inbox' && User.user.inbox && User.user.inbox.newMessages > 0) {
|
||||||
if (toState.name=='options.social.inbox') {
|
|
||||||
User.clearNewMessages();
|
User.clearNewMessages();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ angular.module('habitrpg')
|
|||||||
/**
|
/**
|
||||||
* Services that persists and retrieves user from localStorage.
|
* 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',
|
.factory('User', ['$rootScope', '$http', '$location', '$window', '$state', '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) {
|
function($rootScope, $http, $location, $window, $state, STORAGE_USER_ID, STORAGE_SETTINGS_ID, Notification, ApiUrl, Tasks, Tags, Content, UserNotifications) {
|
||||||
var authenticated = false;
|
var authenticated = false;
|
||||||
var defaultSettings = {
|
var defaultSettings = {
|
||||||
auth: { apiId: '', apiToken: ''},
|
auth: { apiId: '', apiToken: ''},
|
||||||
@@ -106,7 +106,7 @@ angular.module('habitrpg')
|
|||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
var tasks = response.data.data;
|
var tasks = response.data.data;
|
||||||
syncUserTasks(tasks);
|
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();
|
userServices.clearNewMessages();
|
||||||
}
|
}
|
||||||
$rootScope.$emit('userSynced');
|
$rootScope.$emit('userSynced');
|
||||||
|
|||||||
Reference in New Issue
Block a user