mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-21 19:24:15 +00:00
chat: better behavior for menu notification
This commit is contained in:
parent
60f7a1dbd9
commit
2d6223377f
1 changed files with 8 additions and 3 deletions
|
|
@ -144,7 +144,10 @@ angular.module('habitrpg')
|
|||
});
|
||||
}
|
||||
|
||||
if ($state.is('options.social.party') && document.hasFocus()) { // if we're on the party page, mark the chat as read
|
||||
var docHasFocus = document.hasFocus();
|
||||
var isOnPartyPage = $state.is('options.social.party');
|
||||
|
||||
if (isOnPartyPage && docHasFocus) { // if we're on the party page, mark the chat as read
|
||||
Chat.markChatSeen($rootScope.party._id);
|
||||
} else { // show a notification
|
||||
$rootScope.User.user.newMessages[$rootScope.party._id] = {
|
||||
|
|
@ -161,7 +164,8 @@ angular.module('habitrpg')
|
|||
});
|
||||
|
||||
notif.addEventListener('click', function () {
|
||||
$state.go('options.social.party');
|
||||
if (!isOnPartyPage) $state.go('options.social.party');
|
||||
if (!docHasFocus) Chat.markChatSeen($rootScope.party._id);
|
||||
notif.close();
|
||||
});
|
||||
} else {
|
||||
|
|
@ -169,7 +173,8 @@ angular.module('habitrpg')
|
|||
groupName: $rootScope.party.name,
|
||||
authorName: chatData.user || chatData.uuid,
|
||||
}), function() {
|
||||
$state.go('options.social.party');
|
||||
if (!isOnPartyPage) $state.go('options.social.party');
|
||||
if (!docHasFocus) Chat.markChatSeen($rootScope.party._id);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue