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

Fix emoji picker for editing thread responses #8671

Merged
merged 1 commit into from
May 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
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
) {
Expand Down
13 changes: 13 additions & 0 deletions src/components/structures/ThreadView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -136,6 +137,18 @@ export default class ThreadView extends React.Component<IProps, IState> {
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<ComposerInsertPayload>({
...(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;
Expand Down