Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix quoting messages from the search view #7466

Merged
merged 3 commits into from
Jan 5, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {};
Expand Down Expand Up @@ -842,7 +843,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
this.setState({ callState: call ? call.state : null });
};

private onAction = payload => {
private onAction = async (payload: ActionPayload): Promise<void> => {
switch (payload.action) {
case 'message_sent':
this.checkDesktopNotifications();
Expand Down Expand Up @@ -921,6 +922,12 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {

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,
Expand Down Expand Up @@ -1637,10 +1644,12 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
});
};

private onCancelSearchClick = () => {
this.setState({
searching: false,
searchResults: null,
private onCancelSearchClick = (): Promise<void> => {
return new Promise<void>(resolve => {
this.setState({
searching: false,
searchResults: null,
}, resolve);
});
};

Expand Down