From e88a7e7fa3aa26576eb8b22e2a9fa71c813f8600 Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Fri, 23 Apr 2021 17:25:08 +0400 Subject: [PATCH] Don't show notification if peer is active Temporary fix for bubble position --- src/components/chat/bubbles.ts | 4 ++-- src/lib/appManagers/appMessagesManager.ts | 5 +++++ src/lib/rootScope.ts | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts index 6bea986f..213da50f 100644 --- a/src/components/chat/bubbles.ts +++ b/src/components/chat/bubbles.ts @@ -168,7 +168,7 @@ export default class ChatBubbles { const message = this.chat.getMessage(mid); if(+bubble.dataset.timestamp >= (message.date + serverTimeManager.serverTimeOffset - 1)) { - this.bubbleGroups.addBubble(bubble, message, false); + //this.bubbleGroups.addBubble(bubble, message, false); // ! TEMP COMMENTED return; } @@ -1740,7 +1740,7 @@ export default class ChatBubbles { public setBubblePosition(bubble: HTMLElement, message: any, reverse: boolean) { const dateMessage = this.getDateContainerByMessage(message, reverse); - if(this.chat.type === 'scheduled' || this.chat.type === 'pinned' || true) { + if(this.chat.type === 'scheduled' || this.chat.type === 'pinned'/* || true */) { // ! TEMP COMMENTED const offset = this.stickyIntersector ? 2 : 1; let children = Array.from(dateMessage.container.children).slice(offset) as HTMLElement[]; let i = 0, foundMidOnSameTimestamp = 0; diff --git a/src/lib/appManagers/appMessagesManager.ts b/src/lib/appManagers/appMessagesManager.ts index 40004fd8..73fcb8da 100644 --- a/src/lib/appManagers/appMessagesManager.ts +++ b/src/lib/appManagers/appMessagesManager.ts @@ -3897,6 +3897,11 @@ export class AppMessagesManager { for(const _peerId in this.notificationsToHandle) { const peerId = +_peerId; + + if(rootScope.peerId === peerId) { + continue; + } + const notifyPeerToHandle = this.notificationsToHandle[peerId]; Promise.all([ diff --git a/src/lib/rootScope.ts b/src/lib/rootScope.ts index 2c5c5708..92201138 100644 --- a/src/lib/rootScope.ts +++ b/src/lib/rootScope.ts @@ -120,10 +120,15 @@ export class RootScope extends EventListenerBase { }; public connectionStatus: {[name: string]: ConnectionStatusChange} = {}; public settings: State['settings']; + public peerId = 0; constructor() { super(); + this.on('peer_changed', (peerId) => { + this.peerId = peerId; + }); + this.on('user_auth', (e) => { this.myId = e; });