mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-08-03 04:29:40 +00:00
do not sync automatically on chat seen requests
This commit is contained in:
parent
94e2691bae
commit
a748e57cd7
1 changed files with 2 additions and 1 deletions
|
|
@ -13,13 +13,14 @@ angular.module('habitrpg')
|
||||||
var isUserAvailable = $rootScope.appLoaded === true;
|
var isUserAvailable = $rootScope.appLoaded === true;
|
||||||
var hasUserV = response.data && response.data.userV;
|
var hasUserV = response.data && response.data.userV;
|
||||||
var isNotSync = response.config.url.indexOf('/api/v3/user') !== 0 || response.config.method !== 'GET';
|
var isNotSync = response.config.url.indexOf('/api/v3/user') !== 0 || response.config.method !== 'GET';
|
||||||
|
var isNotMarkChatSeen = response.config.url.indexOf('/chat/seen') === -1; // exclude chat seen requests because with real time chat they would be too many
|
||||||
|
|
||||||
if (isApiCall && isUserAvailable && hasUserV) {
|
if (isApiCall && isUserAvailable && hasUserV) {
|
||||||
var oldUserV = $rootScope.User.user._v;
|
var oldUserV = $rootScope.User.user._v;
|
||||||
$rootScope.User.user._v = response.data.userV;
|
$rootScope.User.user._v = response.data.userV;
|
||||||
|
|
||||||
// Something has changed on the user object that was not tracked here, sync the user
|
// Something has changed on the user object that was not tracked here, sync the user
|
||||||
if (isNotSync && ($rootScope.User.user._v - oldUserV) > 1) {
|
if (isNotMarkChatSeen && isNotSync && ($rootScope.User.user._v - oldUserV) > 1) {
|
||||||
$rootScope.User.sync();
|
$rootScope.User.sync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue