Browse Source

View discussion button

master
Eduard Kuzmenko 3 years ago
parent
commit
9381802bf4
  1. 2
      src/components/chat/chat.ts
  2. 25
      src/components/chat/topbar.ts
  3. 1
      src/lang.ts

2
src/components/chat/chat.ts

@ -173,7 +173,7 @@ export default class Chat extends EventListenerBase<{ @@ -173,7 +173,7 @@ export default class Chat extends EventListenerBase<{
public init(/* peerId: number */) {
// 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.appProfileManager);
this.bubbles = new ChatBubbles(this, this.appMessagesManager, this.appStickersManager, this.appUsersManager, this.appInlineBotsManager, this.appPhotosManager, this.appPeersManager, this.appProfileManager, this.appDraftsManager, this.appMessagesIdsManager);
this.input = new ChatInput(this, this.appMessagesManager, this.appMessagesIdsManager, this.appDocsManager, this.appChatsManager, this.appPeersManager, this.appWebPagesManager, this.appImManager, this.appDraftsManager, this.serverTimeManager, this.appNotificationsManager, this.appEmojiManager, this.appUsersManager, this.appInlineBotsManager);
this.selection = new ChatSelection(this, this.bubbles, this.input, this.appMessagesManager);

25
src/components/chat/topbar.ts

@ -9,6 +9,7 @@ import type { AppChatsManager, Channel } from "../../lib/appManagers/appChatsMan @@ -9,6 +9,7 @@ import type { AppChatsManager, Channel } from "../../lib/appManagers/appChatsMan
import type { AppMessagesManager } from "../../lib/appManagers/appMessagesManager";
import type { AppPeersManager } from "../../lib/appManagers/appPeersManager";
import type { AppSidebarRight } from "../sidebarRight";
import type { AppProfileManager } from "../../lib/appManagers/appProfileManager";
import type Chat from "./chat";
import { RIGHT_COLUMN_ACTIVE_CLASSNAME } from "../sidebarRight";
import mediaSizes, { ScreenSize } from "../../helpers/mediaSizes";
@ -35,6 +36,7 @@ import { attachClickEvent } from "../../helpers/dom/clickEvent"; @@ -35,6 +36,7 @@ import { attachClickEvent } from "../../helpers/dom/clickEvent";
import findUpTag from "../../helpers/dom/findUpTag";
import { toast } from "../toast";
import replaceContent from "../../helpers/dom/replaceContent";
import { ChatFull } from "../../layer";
export default class ChatTopbar {
public container: HTMLDivElement;
@ -62,7 +64,14 @@ export default class ChatTopbar { @@ -62,7 +64,14 @@ export default class ChatTopbar {
private menuButtons: (ButtonMenuItemOptions & {verify: () => boolean})[] = [];
constructor(private chat: Chat, private appSidebarRight: AppSidebarRight, private appMessagesManager: AppMessagesManager, private appPeersManager: AppPeersManager, private appChatsManager: AppChatsManager, private appNotificationsManager: AppNotificationsManager) {
constructor(private chat: Chat,
private appSidebarRight: AppSidebarRight,
private appMessagesManager: AppMessagesManager,
private appPeersManager: AppPeersManager,
private appChatsManager: AppChatsManager,
private appNotificationsManager: AppNotificationsManager,
private appProfileManager: AppProfileManager
) {
this.listenerSetter = new ListenerSetter();
}
@ -215,6 +224,20 @@ export default class ChatTopbar { @@ -215,6 +224,20 @@ export default class ChatTopbar {
this.appMessagesManager.mutePeer(this.peerId);
},
verify: () => this.chat.type === 'chat' && rootScope.myId !== this.peerId && this.appNotificationsManager.isPeerLocalMuted(this.peerId, false)
}, {
icon: 'comments',
text: 'ViewDiscussion',
onClick: () => {
this.appProfileManager.getChannelFull(-this.peerId).then(channelFull => {
if(channelFull.linked_chat_id) {
this.chat.appImManager.setInnerPeer(-channelFull.linked_chat_id);
}
});
},
verify: () => {
const chatFull = this.appProfileManager.chatsFull[-this.peerId];
return this.chat.type === 'chat' && this.appPeersManager.isBroadcast(this.peerId) && !!(chatFull as ChatFull.channelFull)?.linked_chat_id;
}
}, {
icon: 'select',
text: 'Chat.Menu.SelectMessages',

1
src/lang.ts

@ -547,6 +547,7 @@ const lang = { @@ -547,6 +547,7 @@ const lang = {
"ViewInChat": "View in chat",
"LinkNotFound": "Unfortunately, you can\'t access this message. You are not a member of the chat where it was posted.",
"Create": "Create",
"ViewDiscussion": "View discussion",
// * macos
"AccountSettings.Filters": "Chat Folders",

Loading…
Cancel
Save