Skip to content

Commit 2c0e465

Browse files
committed
Auto close forum tabs when the respective dialog is dropped
1 parent e48cf2b commit 2c0e465

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

‎src/components/forumTab/forumTab.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import {MAX_SIDEBAR_WIDTH} from '@components/sidebarLeft/constants';
1515
import SetTransition from '@components/singleTransition';
1616
import {SliderSuperTabEventable} from '@components/sliderTab';
1717
import {Register} from '@components/forumTab/register';
18+
import rootScope from '@lib/rootScope';
19+
import {isDialog} from '@lib/appManagers/utils/dialogs/isDialog';
1820

1921

2022
export class ForumTab extends SliderSuperTabEventable {
@@ -57,6 +59,11 @@ export class ForumTab extends SliderSuperTabEventable {
5759
};
5860

5961
protected syncInit(): void {
62+
this.listenerSetter.add(rootScope)('dialog_drop', (dialog) => {
63+
if(isDialog(dialog) && this.peerId === dialog.peerId) {
64+
this._close();
65+
}
66+
});
6067
}
6168

6269
protected async asyncInit(): Promise<void> {

‎src/components/forumTab/monoforumTab.ts‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ export class MonoforumTab extends ForumTab {
4343
autonomousList.bindScrollable();
4444

4545

46-
this.listenerSetter.add(rootScope)('dialog_drop', (dialog) => {
47-
if(dialog.peerId === this.peerId) {
48-
this._close();
49-
}
50-
});
51-
5246
this.listenerSetter.add(rootScope)('monoforum_dialogs_update', ({dialogs}) => {
5347
if(!dialogs.find(dialog => dialog.parentPeerId === this.peerId)) return;
5448
this.updateDialogsCount();

0 commit comments

Comments
 (0)