From e0bebefa391a187774626b26f39af24d9c14e6e2 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 5 Jan 2022 13:40:33 +0000 Subject: [PATCH 1/2] Jump out of search when quoting so there's a composer to quote into --- src/components/structures/RoomView.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 73e5d4532cc..81e9bdd85a7 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -100,6 +100,7 @@ import { ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload"; import AppsDrawer from '../views/rooms/AppsDrawer'; import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload'; import { RightPanelPhases } from '../../stores/RightPanelStorePhases'; +import { ActionPayload } from "../../dispatcher/payloads"; const DEBUG = false; let debuglog = function(msg: string) {}; @@ -842,7 +843,7 @@ export class RoomView extends React.Component { this.setState({ callState: call ? call.state : null }); }; - private onAction = payload => { + private onAction = async (payload: ActionPayload): Promise => { switch (payload.action) { case 'message_sent': this.checkDesktopNotifications(); @@ -921,6 +922,12 @@ export class RoomView extends React.Component { case Action.ComposerInsert: { if (payload.composerType) break; + + if (this.state.searching && payload.timelineRenderingType === TimelineRenderingType.Room) { + // we don't have the composer rendered in this state, so bring it back first + await this.onCancelSearchClick(); + } + // re-dispatch to the correct composer dis.dispatch({ ...payload, @@ -1637,10 +1644,12 @@ export class RoomView extends React.Component { }); }; - private onCancelSearchClick = () => { - this.setState({ - searching: false, - searchResults: null, + private onCancelSearchClick = (): Promise => { + return new Promise(resolve => { + this.setState({ + searching: false, + searchResults: null, + }, resolve); }); }; From dfc9ca4b0711b16c37141c77f4b6ad9575077657 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 5 Jan 2022 15:51:26 +0000 Subject: [PATCH 2/2] delint --- src/components/structures/RoomView.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 7da63e52015..a20f0e55aea 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -98,10 +98,8 @@ import { dispatchShowThreadEvent } from '../../dispatcher/dispatch-actions/threa import { fetchInitialEvent } from "../../utils/EventUtils"; import { ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload"; import AppsDrawer from '../views/rooms/AppsDrawer'; -import { SetRightPanelPhasePayload } from '../../dispatcher/payloads/SetRightPanelPhasePayload'; -import { RightPanelPhases } from '../../stores/RightPanelStorePhases'; -import { ActionPayload } from "../../dispatcher/payloads"; import { RightPanelPhases } from '../../stores/right-panel/RightPanelStorePhases'; +import { ActionPayload } from "../../dispatcher/payloads"; const DEBUG = false; let debuglog = function(msg: string) {};