@@ -7,7 +7,7 @@ import {isSystemMessage} from 'mattermost-redux/utils/post_utils';
77import AttachCommentToIssuePostMenuAction from '@/components/post_menu_actions/attach_comment_to_issue' ;
88import AttachCommentToIssueModal from '@/components/modals/attach_comment_to_issue' ;
99
10- import { getConnected , openAttachCommentToIssueModal , openCreateIssueModal , setShowRHSAction } from '@/actions' ;
10+ import { getConnected , openAttachCommentToIssueModal , openCreateIssueModal , setShowRHSAction , getSidebarContent , updateRhsState } from '@/actions' ;
1111
1212import CreateIssueModal from './components/modals/create_issue' ;
1313import CreateIssuePostMenuAction from './components/post_menu_action/create_issue' ;
@@ -71,6 +71,23 @@ class PluginClass {
7171 const { showRHSPlugin} = registry . registerRightHandSidebarComponent ( SidebarRight , 'GitHub' ) ;
7272 store . dispatch ( setShowRHSAction ( ( ) => store . dispatch ( showRHSPlugin ) ) ) ;
7373
74+ registry . registerRHSPluginPopoutListener ( pluginId , ( teamName , channelName , listeners ) => {
75+ listeners . onMessageFromPopout ( ( channel ) => {
76+ if ( channel === 'GET_RHS_STATE' ) {
77+ listeners . sendToPopout ( 'SEND_RHS_STATE' , store . getState ( ) [ `plugins-${ manifest . id } ` ] . rhsState ) ;
78+ }
79+ } ) ;
80+ } ) ;
81+ if ( window . WebappUtils . popouts . isPopoutWindow ( ) ) {
82+ store . dispatch ( getSidebarContent ( ) ) ;
83+ window . WebappUtils . popouts . onMessageFromParent ( ( channel , state ) => {
84+ if ( channel === 'SEND_RHS_STATE' ) {
85+ store . dispatch ( updateRhsState ( state ) ) ;
86+ }
87+ } ) ;
88+ window . WebappUtils . popouts . sendToParent ( 'GET_RHS_STATE' ) ;
89+ }
90+
7491 registry . registerWebSocketEventHandler ( `custom_${ pluginId } _connect` , handleConnect ( store ) ) ;
7592 registry . registerWebSocketEventHandler ( `custom_${ pluginId } _disconnect` , handleDisconnect ( store ) ) ;
7693 registry . registerWebSocketEventHandler ( `custom_${ pluginId } _config_update` , handleConfigurationUpdate ( store ) ) ;
0 commit comments