|
|
@ -12,7 +12,7 @@ |
|
|
|
import { MOUNT_CLASS_TO } from "../../config/debug"; |
|
|
|
import { MOUNT_CLASS_TO } from "../../config/debug"; |
|
|
|
import { numberThousandSplitter } from "../../helpers/number"; |
|
|
|
import { numberThousandSplitter } from "../../helpers/number"; |
|
|
|
import { isObject, safeReplaceObject, copy, deepEqual } from "../../helpers/object"; |
|
|
|
import { isObject, safeReplaceObject, copy, deepEqual } from "../../helpers/object"; |
|
|
|
import { ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatFull, ChatParticipant, ChatParticipants, InputChannel, InputChatPhoto, InputFile, InputPeer, SendMessageAction, Update, Updates } from "../../layer"; |
|
|
|
import { ChannelParticipant, Chat, ChatAdminRights, ChatBannedRights, ChatFull, ChatParticipant, ChatParticipants, ChatPhoto, InputChannel, InputChatPhoto, InputFile, InputPeer, SendMessageAction, Update, Updates } from "../../layer"; |
|
|
|
import { i18n, LangPackKey } from "../langPack"; |
|
|
|
import { i18n, LangPackKey } from "../langPack"; |
|
|
|
import apiManagerProxy from "../mtproto/mtprotoworker"; |
|
|
|
import apiManagerProxy from "../mtproto/mtprotoworker"; |
|
|
|
import apiManager from '../mtproto/mtprotoworker'; |
|
|
|
import apiManager from '../mtproto/mtprotoworker'; |
|
|
@ -178,7 +178,8 @@ export class AppChatsManager { |
|
|
|
apiChats.forEach(chat => this.saveApiChat(chat, override)); |
|
|
|
apiChats.forEach(chat => this.saveApiChat(chat, override)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public saveApiChat(chat: any, override?: boolean) { |
|
|
|
public saveApiChat(chat: Chat, override?: boolean) { |
|
|
|
|
|
|
|
if(chat._ === 'chatEmpty') return; |
|
|
|
/* if(chat._ !== 'chat' && chat._ !== 'channel') { |
|
|
|
/* if(chat._ !== 'chat' && chat._ !== 'channel') { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} */ |
|
|
|
} */ |
|
|
@ -186,17 +187,17 @@ export class AppChatsManager { |
|
|
|
// * exclude from state
|
|
|
|
// * exclude from state
|
|
|
|
// defineNotNumerableProperties(chat, ['rTitle', 'initials']);
|
|
|
|
// defineNotNumerableProperties(chat, ['rTitle', 'initials']);
|
|
|
|
|
|
|
|
|
|
|
|
const oldChat = this.chats[chat.id]; |
|
|
|
const oldChat: Exclude<Chat, Chat.chatEmpty> = this.chats[chat.id]; |
|
|
|
|
|
|
|
|
|
|
|
/* if(oldChat && !override) { |
|
|
|
/* if(oldChat && !override) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} */ |
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
|
|
if(chat.pFlags === undefined) { |
|
|
|
if((chat as Chat.chat).pFlags === undefined) { |
|
|
|
chat.pFlags = {}; |
|
|
|
(chat as Chat.chat).pFlags = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(chat.pFlags.min && oldChat !== undefined) { |
|
|
|
if((chat as Chat.channel).pFlags.min && oldChat !== undefined) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -205,8 +206,8 @@ export class AppChatsManager { |
|
|
|
if(chat._ === 'channel' && |
|
|
|
if(chat._ === 'channel' && |
|
|
|
chat.participants_count === undefined && |
|
|
|
chat.participants_count === undefined && |
|
|
|
oldChat !== undefined && |
|
|
|
oldChat !== undefined && |
|
|
|
oldChat.participants_count) { |
|
|
|
(oldChat as Chat.channel).participants_count) { |
|
|
|
chat.participants_count = oldChat.participants_count; |
|
|
|
chat.participants_count = (oldChat as Chat.channel).participants_count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* if(chat.username) { |
|
|
|
/* if(chat.username) { |
|
|
@ -218,9 +219,9 @@ export class AppChatsManager { |
|
|
|
if(oldChat === undefined) { |
|
|
|
if(oldChat === undefined) { |
|
|
|
this.chats[chat.id] = chat; |
|
|
|
this.chats[chat.id] = chat; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const oldPhoto = oldChat.photo?.photo_small; |
|
|
|
const oldPhotoId = ((oldChat as Chat.chat).photo as ChatPhoto.chatPhoto)?.photo_id; |
|
|
|
const newPhoto = chat.photo?.photo_small; |
|
|
|
const newPhotoId = ((chat as Chat.chat).photo as ChatPhoto.chatPhoto)?.photo_id; |
|
|
|
if(JSON.stringify(oldPhoto) !== JSON.stringify(newPhoto)) { |
|
|
|
if(oldPhotoId !== newPhotoId) { |
|
|
|
changedPhoto = true; |
|
|
|
changedPhoto = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|