mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-01 19:50:37 +00:00
fix(private-messages): clear newMessages both when leaving and entering inbox
This commit is contained in:
parent
a429dce5dd
commit
1539c35d29
2 changed files with 5 additions and 6 deletions
|
|
@ -77,12 +77,7 @@ window.habitrpg = angular.module('habitrpg',
|
|||
|
||||
.state('options.social.inbox', {
|
||||
url: "/inbox",
|
||||
templateUrl: "partials/options.social.inbox.html",
|
||||
controller: ['$rootScope', function($rootScope){
|
||||
// clear "new messages"
|
||||
//$rootScope.$on('userSynced',function(){
|
||||
$rootScope.User.user.ops.update && $rootScope.set({'inbox.newMessages':0});
|
||||
}]
|
||||
templateUrl: "partials/options.social.inbox.html"
|
||||
})
|
||||
|
||||
.state('options.social.tavern', {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$
|
|||
$rootScope.$on('$stateChangeSuccess',
|
||||
function(event, toState, toParams, fromState, fromParams){
|
||||
if (!!fromState.name) window.ga && ga('send', 'pageview', {page: '/#/'+toState.name});
|
||||
// clear inbox when entering or exiting inbox tab
|
||||
if (fromState.name=='options.social.inbox' || toState.name=='options.social.inbox') {
|
||||
User.user.ops.update && User.set({'inbox.newMessages':0});
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.User = User;
|
||||
|
|
|
|||
Loading…
Reference in a new issue