diff --git a/server/Makefile b/server/Makefile index ca5e872ac01..e3d08bdf789 100644 --- a/server/Makefile +++ b/server/Makefile @@ -163,7 +163,7 @@ PLUGIN_PACKAGES += mattermost-plugin-jira-v4.8.0 PLUGIN_PACKAGES += mattermost-plugin-playbooks-v2.11.1 PLUGIN_PACKAGES += mattermost-plugin-servicenow-v2.4.0 PLUGIN_PACKAGES += mattermost-plugin-zoom-v1.13.0 -PLUGIN_PACKAGES += mattermost-plugin-agents-v2.6.0 +PLUGIN_PACKAGES += mattermost-plugin-agents-v2.6.1 PLUGIN_PACKAGES += mattermost-plugin-boards-v9.4.0 PLUGIN_PACKAGES += mattermost-plugin-user-survey-v1.1.1 PLUGIN_PACKAGES += mattermost-plugin-mscalendar-v1.7.0 @@ -178,7 +178,7 @@ PLUGIN_PACKAGES += mattermost-plugin-dataminr-v2.0.0 # the way we pre-package FIPS and non-FIPS plugins. ifeq ($(FIPS_ENABLED),true) PLUGIN_PACKAGES = mattermost-plugin-playbooks-v2.11.1%2B329b65c-fips - PLUGIN_PACKAGES += mattermost-plugin-agents-v2.6.0%2B7824854-fips + PLUGIN_PACKAGES += mattermost-plugin-agents-v2.6.1%2B0b1b771-fips PLUGIN_PACKAGES += mattermost-plugin-boards-v9.4.0%2B4b7dd4b-fips endif diff --git a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.test.tsx b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.test.tsx index cba4e23d08f..af1af8c26a5 100644 --- a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.test.tsx +++ b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.test.tsx @@ -299,6 +299,49 @@ describe('components/avanced_text_editor/advanced_text_editor', () => { expect(screen.getByPlaceholderText('Write to Other Channel')).toHaveValue('a different draft'); }); + it('should mount and send when rootId is omitted, as plugins may do via window.Components', async () => { + // Plugins reach AdvancedTextEditor through the untyped window.Components bridge, so + // TypeScript cannot enforce the required rootId prop. An undefined rootId used to + // mismatch the draft's '' on every render pass, throwing React error #301 on mount + // and, once mounted, leaving the post-submit draft reset silently dropped. + const message = 'a message sent from a composer without a rootId'; + + renderWithContext( + , + mergeObjects(initialState, { + entities: { + roles: { + roles: { + user_roles: {permissions: [Permissions.CREATE_POST]}, + }, + }, + }, + }), + ); + + const textbox = screen.getByTestId('post_textbox'); + + // SuggestionBox listens to onInput, not onChange. + fireEvent.input(textbox, {target: {value: message}}); + expect(textbox).toHaveValue(message); + + await act(async () => { + fireEvent.click(screen.getByTestId('SendMessageButton')); + }); + + expect(mockedOnSubmit).toHaveBeenCalledWith( + channelId, + '', + expect.objectContaining({message, channelId, rootId: ''}), + expect.anything(), + undefined, + ); + expect(textbox).toHaveValue(''); + }); + it('should submit a destination-owned draft while the textbox still holds the previous channel value', async () => { const sourceDraft = 'stale draft from the source channel'; const destinationMessage = 'new message composed for the destination channel'; diff --git a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx index f58bf0cd769..ccab9589847 100644 --- a/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx +++ b/webapp/channels/src/components/advanced_text_editor/advanced_text_editor.tsx @@ -125,7 +125,7 @@ export type Props = { const AdvancedTextEditor = ({ location, channelId, - rootId, + rootId: rootIdProp, postId, isThreadView = false, placeholder, @@ -133,6 +133,11 @@ const AdvancedTextEditor = ({ afterSubmit, storageKey, }: Props) => { + // rootId is typed as required, but plugins reach this component through the untyped + // window.Components bridge and may omit it. Every draft carries '' rather than undefined + // for a non-thread composer, so an undefined prop desyncs the id comparisons below. + const rootId = rootIdProp ?? ''; + const {formatMessage} = useIntl(); const dispatch = useDispatch();