Fix emoji picker for editing thread responses (#8671)

This commit is contained in:
Michael Telatynski 2022-05-23 16:07:17 +01:00 committed by GitHub
parent 20fd68b902
commit b4d657b21f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View file

@ -883,6 +883,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
if (payload.composerType) break; if (payload.composerType) break;
let timelineRenderingType: TimelineRenderingType = payload.timelineRenderingType; 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 && if (this.state.timelineRenderingType === TimelineRenderingType.Search &&
payload.timelineRenderingType === TimelineRenderingType.Search payload.timelineRenderingType === TimelineRenderingType.Search
) { ) {

View file

@ -53,6 +53,7 @@ import PosthogTrackers from "../../PosthogTrackers";
import { ButtonEvent } from "../views/elements/AccessibleButton"; import { ButtonEvent } from "../views/elements/AccessibleButton";
import { RoomViewStore } from '../../stores/RoomViewStore'; import { RoomViewStore } from '../../stores/RoomViewStore';
import Spinner from "../views/elements/Spinner"; import Spinner from "../views/elements/Spinner";
import { ComposerInsertPayload, ComposerType } from "../../dispatcher/payloads/ComposerInsertPayload";
interface IProps { interface IProps {
room: Room; room: Room;
@ -136,6 +137,18 @@ export default class ThreadView extends React.Component<IProps, IState> {
this.setupThread(payload.event); this.setupThread(payload.event);
} }
switch (payload.action) { 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: case Action.EditEvent:
// Quit early if it's not a thread context // Quit early if it's not a thread context
if (payload.timelineRenderingType !== TimelineRenderingType.Thread) return; if (payload.timelineRenderingType !== TimelineRenderingType.Thread) return;