From 0ff04a2a6d5937a8f95b7a55c26a6af569048070 Mon Sep 17 00:00:00 2001 From: Devin Binnie Date: Fri, 19 Dec 2025 12:34:57 -0500 Subject: [PATCH 1/2] Pass RHS state to the pop-out --- webapp/src/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/webapp/src/index.js b/webapp/src/index.js index ac44b3442..3ed06a1de 100644 --- a/webapp/src/index.js +++ b/webapp/src/index.js @@ -7,7 +7,7 @@ import {isSystemMessage} from 'mattermost-redux/utils/post_utils'; import AttachCommentToIssuePostMenuAction from '@/components/post_menu_actions/attach_comment_to_issue'; import AttachCommentToIssueModal from '@/components/modals/attach_comment_to_issue'; -import {getConnected, openAttachCommentToIssueModal, openCreateIssueModal, setShowRHSAction} from '@/actions'; +import {getConnected, openAttachCommentToIssueModal, openCreateIssueModal, setShowRHSAction, getSidebarContent, updateRhsState} from '@/actions'; import CreateIssueModal from './components/modals/create_issue'; import CreateIssuePostMenuAction from './components/post_menu_action/create_issue'; @@ -71,6 +71,23 @@ class PluginClass { const {showRHSPlugin} = registry.registerRightHandSidebarComponent(SidebarRight, 'GitHub'); store.dispatch(setShowRHSAction(() => store.dispatch(showRHSPlugin))); + registry.registerRHSPluginPopoutListener(pluginId, (teamName, channelName, listeners) => { + listeners.onMessageFromPopout((channel) => { + if (channel === 'GET_RHS_STATE') { + listeners.sendToPopout('SEND_RHS_STATE', store.getState()[`plugins-${manifest.id}`].rhsState); + } + }); + }); + if (window.WebappUtils.popouts.isPopoutWindow()) { + store.dispatch(getSidebarContent()); + window.WebappUtils.popouts.onMessageFromParent((channel, state) => { + if (channel === 'SEND_RHS_STATE') { + store.dispatch(updateRhsState(state)); + } + }); + window.WebappUtils.popouts.sendToParent('GET_RHS_STATE'); + } + registry.registerWebSocketEventHandler(`custom_${pluginId}_connect`, handleConnect(store)); registry.registerWebSocketEventHandler(`custom_${pluginId}_disconnect`, handleDisconnect(store)); registry.registerWebSocketEventHandler(`custom_${pluginId}_config_update`, handleConfigurationUpdate(store)); From 508ea71781f12135585ba91388859f26aab2beea Mon Sep 17 00:00:00 2001 From: Devin Binnie Date: Fri, 19 Dec 2025 12:58:20 -0500 Subject: [PATCH 2/2] Check for popouts before running the function --- webapp/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/src/index.js b/webapp/src/index.js index 3ed06a1de..43f0aac95 100644 --- a/webapp/src/index.js +++ b/webapp/src/index.js @@ -78,7 +78,7 @@ class PluginClass { } }); }); - if (window.WebappUtils.popouts.isPopoutWindow()) { + if (window.WebappUtils.popouts && window.WebappUtils.popouts.isPopoutWindow()) { store.dispatch(getSidebarContent()); window.WebappUtils.popouts.onMessageFromParent((channel, state) => { if (channel === 'SEND_RHS_STATE') {