Browse Source

Fix forwarding messages

master
morethanwords 4 years ago
parent
commit
5b0f0286d9
  1. 11
      src/components/chat/chat.ts
  2. 4
      src/components/chat/input.ts

11
src/components/chat/chat.ts

@ -38,6 +38,7 @@ export default class Chat extends EventListenerBase<{
public selection: ChatSelection; public selection: ChatSelection;
public contextMenu: ChatContextMenu; public contextMenu: ChatContextMenu;
public wasAlreadyUsed = false;
public initPeerId = 0; public initPeerId = 0;
public peerId = 0; public peerId = 0;
public threadId: number; public threadId: number;
@ -133,8 +134,8 @@ export default class Chat extends EventListenerBase<{
//this.log.error('Chat destroy time:', performance.now() - perf); //this.log.error('Chat destroy time:', performance.now() - perf);
} }
public cleanup() { public cleanup(helperToo = true) {
this.input.cleanup(); this.input.cleanup(helperToo);
this.selection.cleanup(); this.selection.cleanup();
} }
@ -155,7 +156,7 @@ export default class Chat extends EventListenerBase<{
////console.time('appImManager: pre render start'); ////console.time('appImManager: pre render start');
if(!peerId) { if(!peerId) {
appSidebarRight.toggleSidebar(false); appSidebarRight.toggleSidebar(false);
this.cleanup(); this.cleanup(true);
this.topbar.setPeer(peerId); this.topbar.setPeer(peerId);
this.bubbles.setPeer(peerId); this.bubbles.setPeer(peerId);
rootScope.broadcast('peer_changed', peerId); rootScope.broadcast('peer_changed', peerId);
@ -170,6 +171,7 @@ export default class Chat extends EventListenerBase<{
} }
appSidebarRight.sharedMediaTab.setPeer(peerId, this.threadId); appSidebarRight.sharedMediaTab.setPeer(peerId, this.threadId);
this.input.clearHelper(); // костыль
} }
this.peerChanged = samePeer; this.peerChanged = samePeer;
@ -208,7 +210,7 @@ export default class Chat extends EventListenerBase<{
let peerId = this.peerId; let peerId = this.peerId;
this.peerChanged = true; this.peerChanged = true;
this.cleanup(); this.cleanup(false);
this.topbar.setPeer(peerId); this.topbar.setPeer(peerId);
this.topbar.finishPeerChange(isTarget, isJump, lastMsgId); this.topbar.finishPeerChange(isTarget, isJump, lastMsgId);
@ -220,6 +222,7 @@ export default class Chat extends EventListenerBase<{
this.log.setPrefix('CHAT-' + peerId + '-' + this.type); this.log.setPrefix('CHAT-' + peerId + '-' + this.type);
rootScope.broadcast('peer_changed', peerId); rootScope.broadcast('peer_changed', peerId);
this.wasAlreadyUsed = true;
} }
public getMessagesStorage() { public getMessagesStorage() {

4
src/components/chat/input.ts

@ -522,7 +522,7 @@ export default class ChatInput {
this.listenerSetter.removeAll(); this.listenerSetter.removeAll();
} }
public cleanup() { public cleanup(helperToo = true) {
if(!this.chat.peerId) { if(!this.chat.peerId) {
this.chatInput.style.display = 'none'; this.chatInput.style.display = 'none';
this.goDownBtn.classList.add('hide'); this.goDownBtn.classList.add('hide');
@ -532,7 +532,7 @@ export default class ChatInput {
if(this.messageInput) { if(this.messageInput) {
this.clearInput(); this.clearInput();
this.clearHelper(); helperToo && this.clearHelper();
} }
} }

Loading…
Cancel
Save