|
|
|
@ -12,7 +12,7 @@
@@ -12,7 +12,7 @@
|
|
|
|
|
import { MOUNT_CLASS_TO } from "../../config/debug"; |
|
|
|
|
import { numberThousandSplitter } from "../../helpers/number"; |
|
|
|
|
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 apiManagerProxy from "../mtproto/mtprotoworker"; |
|
|
|
|
import apiManager from '../mtproto/mtprotoworker'; |
|
|
|
@ -178,7 +178,8 @@ export class AppChatsManager {
@@ -178,7 +178,8 @@ export class AppChatsManager {
|
|
|
|
|
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') { |
|
|
|
|
return; |
|
|
|
|
} */ |
|
|
|
@ -186,17 +187,17 @@ export class AppChatsManager {
@@ -186,17 +187,17 @@ export class AppChatsManager {
|
|
|
|
|
// * exclude from state
|
|
|
|
|
// defineNotNumerableProperties(chat, ['rTitle', 'initials']);
|
|
|
|
|
|
|
|
|
|
const oldChat = this.chats[chat.id]; |
|
|
|
|
const oldChat: Exclude<Chat, Chat.chatEmpty> = this.chats[chat.id]; |
|
|
|
|
|
|
|
|
|
/* if(oldChat && !override) { |
|
|
|
|
return; |
|
|
|
|
} */ |
|
|
|
|
|
|
|
|
|
if(chat.pFlags === undefined) { |
|
|
|
|
chat.pFlags = {}; |
|
|
|
|
if((chat as Chat.chat).pFlags === undefined) { |
|
|
|
|
(chat as Chat.chat).pFlags = {}; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(chat.pFlags.min && oldChat !== undefined) { |
|
|
|
|
if((chat as Chat.channel).pFlags.min && oldChat !== undefined) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -205,8 +206,8 @@ export class AppChatsManager {
@@ -205,8 +206,8 @@ export class AppChatsManager {
|
|
|
|
|
if(chat._ === 'channel' && |
|
|
|
|
chat.participants_count === undefined && |
|
|
|
|
oldChat !== undefined && |
|
|
|
|
oldChat.participants_count) { |
|
|
|
|
chat.participants_count = oldChat.participants_count; |
|
|
|
|
(oldChat as Chat.channel).participants_count) { |
|
|
|
|
chat.participants_count = (oldChat as Chat.channel).participants_count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* if(chat.username) { |
|
|
|
@ -218,9 +219,9 @@ export class AppChatsManager {
@@ -218,9 +219,9 @@ export class AppChatsManager {
|
|
|
|
|
if(oldChat === undefined) { |
|
|
|
|
this.chats[chat.id] = chat; |
|
|
|
|
} else { |
|
|
|
|
const oldPhoto = oldChat.photo?.photo_small; |
|
|
|
|
const newPhoto = chat.photo?.photo_small; |
|
|
|
|
if(JSON.stringify(oldPhoto) !== JSON.stringify(newPhoto)) { |
|
|
|
|
const oldPhotoId = ((oldChat as Chat.chat).photo as ChatPhoto.chatPhoto)?.photo_id; |
|
|
|
|
const newPhotoId = ((chat as Chat.chat).photo as ChatPhoto.chatPhoto)?.photo_id; |
|
|
|
|
if(oldPhotoId !== newPhotoId) { |
|
|
|
|
changedPhoto = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|