Fix loading messages if list is too short
Show 'migrated from' & 'migrated to' service messages
This commit is contained in:
parent
36022a478b
commit
b986510798
@ -73,7 +73,8 @@ import { EmoticonsDropdown } from "../emoticonsDropdown";
|
|||||||
const USE_MEDIA_TAILS = false;
|
const USE_MEDIA_TAILS = false;
|
||||||
const IGNORE_ACTIONS: Set<Message.messageService['action']['_']> = new Set([
|
const IGNORE_ACTIONS: Set<Message.messageService['action']['_']> = new Set([
|
||||||
'messageActionHistoryClear',
|
'messageActionHistoryClear',
|
||||||
'messageActionChatCreate'
|
'messageActionChatCreate'/* ,
|
||||||
|
'messageActionChannelMigrateFrom' */
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const TEST_SCROLL_TIMES: number = undefined;
|
const TEST_SCROLL_TIMES: number = undefined;
|
||||||
@ -1724,6 +1725,8 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
// this.ladderDeferred.resolve();
|
// this.ladderDeferred.resolve();
|
||||||
|
|
||||||
|
this.scrollable.lastScrollDirection = 0;
|
||||||
|
this.scrollable.lastScrollTop = 0;
|
||||||
replaceContent(this.scrollable.container, this.chatInner);
|
replaceContent(this.scrollable.container, this.chatInner);
|
||||||
|
|
||||||
animationIntersector.unlockGroup(CHAT_ANIMATION_GROUP);
|
animationIntersector.unlockGroup(CHAT_ANIMATION_GROUP);
|
||||||
@ -1775,6 +1778,12 @@ export default class ChatBubbles {
|
|||||||
|
|
||||||
this.onScroll();
|
this.onScroll();
|
||||||
|
|
||||||
|
const middleware = this.getMiddleware();
|
||||||
|
const afterSetPromise = Promise.all([setPeerPromise, getHeavyAnimationPromise()]);
|
||||||
|
afterSetPromise.then(() => { // check whether list isn't full
|
||||||
|
this.scrollable.checkForTriggers();
|
||||||
|
});
|
||||||
|
|
||||||
this.chat.dispatchEvent('setPeer', lastMsgId, !isJump);
|
this.chat.dispatchEvent('setPeer', lastMsgId, !isJump);
|
||||||
|
|
||||||
const needFetchInterval = this.appMessagesManager.isFetchIntervalNeeded(peerId);
|
const needFetchInterval = this.appMessagesManager.isFetchIntervalNeeded(peerId);
|
||||||
@ -1785,8 +1794,7 @@ export default class ChatBubbles {
|
|||||||
this.setLoaded('bottom', true);
|
this.setLoaded('bottom', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const middleware = this.getMiddleware();
|
afterSetPromise.then(() => {
|
||||||
Promise.all([setPeerPromise, getHeavyAnimationPromise()]).then(() => {
|
|
||||||
if(!middleware()) {
|
if(!middleware()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2108,8 +2116,14 @@ export default class ChatBubbles {
|
|||||||
const s = document.createElement('div');
|
const s = document.createElement('div');
|
||||||
s.classList.add('service-msg');
|
s.classList.add('service-msg');
|
||||||
if(action) {
|
if(action) {
|
||||||
|
if(action._ === 'messageActionChannelMigrateFrom') {
|
||||||
|
s.append(i18n('ChatMigration.From', [new PeerTitle({peerId: -action.chat_id}).element]));
|
||||||
|
} else if(action._ === 'messageActionChatMigrateTo') {
|
||||||
|
s.append(i18n('ChatMigration.To', [new PeerTitle({peerId: -action.channel_id}).element]));
|
||||||
|
} else {
|
||||||
s.append(this.appMessagesManager.wrapMessageActionTextNew(message));
|
s.append(this.appMessagesManager.wrapMessageActionTextNew(message));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
bubbleContainer.append(s);
|
bubbleContainer.append(s);
|
||||||
|
|
||||||
if(updatePosition) {
|
if(updatePosition) {
|
||||||
|
@ -55,7 +55,7 @@ export default class Chat extends EventListenerBase<{
|
|||||||
public contextMenu: ChatContextMenu;
|
public contextMenu: ChatContextMenu;
|
||||||
|
|
||||||
public wasAlreadyUsed = false;
|
public wasAlreadyUsed = false;
|
||||||
public initPeerId = 0;
|
// public initPeerId = 0;
|
||||||
public peerId = 0;
|
public peerId = 0;
|
||||||
public threadId: number;
|
public threadId: number;
|
||||||
public setPeerPromise: Promise<void>;
|
public setPeerPromise: Promise<void>;
|
||||||
@ -67,6 +67,8 @@ export default class Chat extends EventListenerBase<{
|
|||||||
|
|
||||||
public noAutoDownloadMedia: boolean;
|
public noAutoDownloadMedia: boolean;
|
||||||
|
|
||||||
|
public inited = false;
|
||||||
|
|
||||||
constructor(public appImManager: AppImManager,
|
constructor(public appImManager: AppImManager,
|
||||||
public appChatsManager: AppChatsManager,
|
public appChatsManager: AppChatsManager,
|
||||||
public appDocsManager: AppDocsManager,
|
public appDocsManager: AppDocsManager,
|
||||||
@ -166,8 +168,8 @@ export default class Chat extends EventListenerBase<{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(peerId: number) {
|
public init(/* peerId: number */) {
|
||||||
this.initPeerId = peerId;
|
// this.initPeerId = peerId;
|
||||||
|
|
||||||
this.topbar = new ChatTopbar(this, appSidebarRight, this.appMessagesManager, this.appPeersManager, this.appChatsManager, this.appNotificationsManager);
|
this.topbar = new ChatTopbar(this, appSidebarRight, this.appMessagesManager, this.appPeersManager, this.appChatsManager, this.appNotificationsManager);
|
||||||
this.bubbles = new ChatBubbles(this, this.appMessagesManager, this.appStickersManager, this.appUsersManager, this.appInlineBotsManager, this.appPhotosManager, this.appPeersManager, this.appProfileManager);
|
this.bubbles = new ChatBubbles(this, this.appMessagesManager, this.appStickersManager, this.appUsersManager, this.appInlineBotsManager, this.appPhotosManager, this.appPeersManager, this.appProfileManager);
|
||||||
@ -246,11 +248,17 @@ export default class Chat extends EventListenerBase<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public setPeer(peerId: number, lastMsgId?: number) {
|
public setPeer(peerId: number, lastMsgId?: number) {
|
||||||
|
if(!peerId) {
|
||||||
|
this.inited = false;
|
||||||
|
} else if(!this.inited) {
|
||||||
if(this.init) {
|
if(this.init) {
|
||||||
this.init(peerId);
|
this.init(/* peerId */);
|
||||||
this.init = null;
|
this.init = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.inited = true;
|
||||||
|
}
|
||||||
|
|
||||||
const samePeer = this.peerId === peerId;
|
const samePeer = this.peerId === peerId;
|
||||||
if(!samePeer) {
|
if(!samePeer) {
|
||||||
rootScope.dispatchEvent('peer_changing', this);
|
rootScope.dispatchEvent('peer_changing', this);
|
||||||
|
@ -1168,7 +1168,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const chat: Chat = appChatsManager.getChat(-this.peerId);
|
const chat: Chat = appChatsManager.getChat(-this.peerId);
|
||||||
if(chat._ === 'chat' || (chat as Chat.channel).admin_rights) {
|
if((chat._ === 'chat' || (chat as Chat.channel).admin_rights) && !(chat as Chat.chat).pFlags.deactivated) {
|
||||||
this.editBtn.style.display = '';
|
this.editBtn.style.display = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ const App = {
|
|||||||
id: 1025907,
|
id: 1025907,
|
||||||
hash: '452b0359b988148995f22ff0f4229750',
|
hash: '452b0359b988148995f22ff0f4229750',
|
||||||
version: '0.6.0',
|
version: '0.6.0',
|
||||||
langPackVersion: '0.3.0',
|
langPackVersion: '0.3.1',
|
||||||
langPack: 'macos',
|
langPack: 'macos',
|
||||||
langPackCode: 'en',
|
langPackCode: 'en',
|
||||||
domains: [MAIN_DOMAIN] as string[],
|
domains: [MAIN_DOMAIN] as string[],
|
||||||
|
@ -46,6 +46,8 @@ const lang = {
|
|||||||
//"ChatList.Menu.Archived": "Archived",
|
//"ChatList.Menu.Archived": "Archived",
|
||||||
"ChatList.Menu.SwitchTo.Webogram": "Switch to Old Version",
|
"ChatList.Menu.SwitchTo.Webogram": "Switch to Old Version",
|
||||||
"ChatList.Menu.SwitchTo.Z": "Switch to Z version",
|
"ChatList.Menu.SwitchTo.Z": "Switch to Z version",
|
||||||
|
"ChatMigration.From": "Migrated from %s",
|
||||||
|
"ChatMigration.To": "Migrated to %s",
|
||||||
"ConnectionStatus.ForceReconnect": "force reconnect",
|
"ConnectionStatus.ForceReconnect": "force reconnect",
|
||||||
"ConnectionStatus.ReconnectIn": "Reconnect in %ds, %s",
|
"ConnectionStatus.ReconnectIn": "Reconnect in %ds, %s",
|
||||||
"ConnectionStatus.Reconnect": "reconnect",
|
"ConnectionStatus.Reconnect": "reconnect",
|
||||||
|
@ -217,6 +217,10 @@ export class AppChatsManager {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((chat as Chat.chat).pFlags.deactivated && action !== 'view_messages') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(chat.pFlags.creator && rights === undefined) {
|
if(chat.pFlags.creator && rights === undefined) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1025,7 @@ export class AppImManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const chat = this.chat;
|
const chat = this.chat;
|
||||||
if(!chat.init) { // * use first not inited chat
|
if(chat.inited) { // * use first not inited chat
|
||||||
this.createNewChat();
|
this.createNewChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user