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

Commit

Permalink
Fix emoji picker for editing thread responses (#8671)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored May 23, 2022
1 parent 20fd68b commit b4d657b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
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

0 comments on commit b4d657b

Please sign in to comment.