|
|
@ -15,7 +15,7 @@ import cleanSearchText from "../../helpers/cleanSearchText"; |
|
|
|
import cleanUsername from "../../helpers/cleanUsername"; |
|
|
|
import cleanUsername from "../../helpers/cleanUsername"; |
|
|
|
import { tsNow } from "../../helpers/date"; |
|
|
|
import { tsNow } from "../../helpers/date"; |
|
|
|
import { safeReplaceObject, isObject } from "../../helpers/object"; |
|
|
|
import { safeReplaceObject, isObject } from "../../helpers/object"; |
|
|
|
import { InputUser, Update, User as MTUser, UserStatus } from "../../layer"; |
|
|
|
import { InputUser, Update, User as MTUser, UserProfilePhoto, UserStatus } from "../../layer"; |
|
|
|
import I18n, { i18n, LangPackKey } from "../langPack"; |
|
|
|
import I18n, { i18n, LangPackKey } from "../langPack"; |
|
|
|
//import apiManager from '../mtproto/apiManager';
|
|
|
|
//import apiManager from '../mtproto/apiManager';
|
|
|
|
import apiManager from '../mtproto/mtprotoworker'; |
|
|
|
import apiManager from '../mtproto/mtprotoworker'; |
|
|
@ -330,9 +330,11 @@ export class AppUsersManager { |
|
|
|
const userId = user.id; |
|
|
|
const userId = user.id; |
|
|
|
const oldUser = this.users[userId]; |
|
|
|
const oldUser = this.users[userId]; |
|
|
|
|
|
|
|
|
|
|
|
if(oldUser && !override) { |
|
|
|
// ! commented block can affect performance !
|
|
|
|
return; |
|
|
|
// if(oldUser && !override) {
|
|
|
|
} |
|
|
|
// console.log('saveApiUser same');
|
|
|
|
|
|
|
|
// return;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
if(user.pFlags === undefined) { |
|
|
|
if(user.pFlags === undefined) { |
|
|
|
user.pFlags = {}; |
|
|
|
user.pFlags = {}; |
|
|
@ -367,7 +369,7 @@ export class AppUsersManager { |
|
|
|
|
|
|
|
|
|
|
|
//user.sortStatus = user.pFlags.bot ? -1 : this.getUserStatusForSort(user.status);
|
|
|
|
//user.sortStatus = user.pFlags.bot ? -1 : this.getUserStatusForSort(user.status);
|
|
|
|
|
|
|
|
|
|
|
|
let changedTitle = false; |
|
|
|
let changedPhoto = false, changedTitle = false; |
|
|
|
if(oldUser === undefined) { |
|
|
|
if(oldUser === undefined) { |
|
|
|
this.users[userId] = user; |
|
|
|
this.users[userId] = user; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -377,6 +379,12 @@ export class AppUsersManager { |
|
|
|
changedTitle = true; |
|
|
|
changedTitle = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const oldPhotoId = (oldUser.photo as UserProfilePhoto.userProfilePhoto)?.photo_id; |
|
|
|
|
|
|
|
const newPhotoId = (user.photo as UserProfilePhoto.userProfilePhoto)?.photo_id; |
|
|
|
|
|
|
|
if(oldPhotoId !== newPhotoId) { |
|
|
|
|
|
|
|
changedPhoto = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* if(user.pFlags.bot && user.bot_info_version !== oldUser.bot_info_version) { |
|
|
|
/* if(user.pFlags.bot && user.bot_info_version !== oldUser.bot_info_version) { |
|
|
|
|
|
|
|
|
|
|
|
} */ |
|
|
|
} */ |
|
|
@ -385,6 +393,10 @@ export class AppUsersManager { |
|
|
|
rootScope.dispatchEvent('user_update', userId); |
|
|
|
rootScope.dispatchEvent('user_update', userId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(changedPhoto) { |
|
|
|
|
|
|
|
rootScope.dispatchEvent('avatar_update', user.id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(changedTitle) { |
|
|
|
if(changedTitle) { |
|
|
|
rootScope.dispatchEvent('peer_title_edit', user.id); |
|
|
|
rootScope.dispatchEvent('peer_title_edit', user.id); |
|
|
|
} |
|
|
|
} |
|
|
|