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

Only trap escape key for cancel reply if there is a reply #11140

Merged
merged 2 commits into from
Jun 28, 2023
Merged
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
16 changes: 9 additions & 7 deletions src/components/views/rooms/SendMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,15 @@ export class SendMessageComposer extends React.Component<ISendMessageComposerPro
}
break;
case KeyBindingAction.CancelReplyOrEdit:
dis.dispatch({
action: "reply_to_event",
event: null,
context: this.context.timelineRenderingType,
});
event.preventDefault();
event.stopPropagation();
if (!!this.context.replyToEvent) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RoomContext doesn't appear to have a replyToEvent. Should this be this.props.replyToEvent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does though, this is from the same file.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so what, the type definition is wrong?

Is there a reason to prefer the value from the context rather than the one in the props?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type definition is right...

image

It is the entirety of IRoomState + an optional threadId

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh, I can't read. Sorry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to prefer the value from the context rather than the one in the props?

They should be the same, I was just matching the existing code I shared in a screenshot above. We could likely get rid of the woven through props value in favour of the context one

dis.dispatch({
action: "reply_to_event",
event: null,
context: this.context.timelineRenderingType,
});
event.preventDefault();
event.stopPropagation();
}
break;
}
};
Expand Down