From b4d657b21f2bbf1e7a56f91672f06e9c0cc12cfe Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Mon, 23 May 2022 16:07:17 +0100 Subject: [PATCH] Fix emoji picker for editing thread responses (#8671) --- src/components/structures/RoomView.tsx | 2 ++ src/components/structures/ThreadView.tsx | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 1539037cf89..86f581512cd 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -883,6 +883,8 @@ export class RoomView extends React.Component { if (payload.composerType) break; let timelineRenderingType: TimelineRenderingType = payload.timelineRenderingType; + // ThreadView handles Action.ComposerInsert itself due to it having its own editState + if (timelineRenderingType === TimelineRenderingType.Thread) break; if (this.state.timelineRenderingType === TimelineRenderingType.Search && payload.timelineRenderingType === TimelineRenderingType.Search ) { diff --git a/src/components/structures/ThreadView.tsx b/src/components/structures/ThreadView.tsx index f1bf103402d..5bcc683fc55 100644 --- a/src/components/structures/ThreadView.tsx +++ b/src/components/structures/ThreadView.tsx @@ -53,6 +53,7 @@ import PosthogTrackers from "../../PosthogTrackers"; import { ButtonEvent } from "../views/elements/AccessibleButton"; import { RoomViewStore } from '../../stores/RoomViewStore'; import Spinner from "../views/elements/Spinner"; +import { ComposerInsertPayload, ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload"; interface IProps { room: Room; @@ -136,6 +137,18 @@ export default class ThreadView extends React.Component { this.setupThread(payload.event); } switch (payload.action) { + case Action.ComposerInsert: { + if (payload.composerType) break; + if (payload.timelineRenderingType !== TimelineRenderingType.Thread) break; + + // re-dispatch to the correct composer + dis.dispatch({ + ...(payload as ComposerInsertPayload), + composerType: this.state.editState ? ComposerType.Edit : ComposerType.Send, + }); + break; + } + case Action.EditEvent: // Quit early if it's not a thread context if (payload.timelineRenderingType !== TimelineRenderingType.Thread) return;