diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index b92ce10d35..dde68e8bad 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -109,4 +109,8 @@ limitations under the License. .mx_MessageContextMenu_iconViewInRoom::before { mask-image: url('$(res)/img/element-icons/view-in-room.svg'); } + + .mx_MessageContextMenu_jumpToEvent::before { + mask-image: url('$(res)/img/element-icons/left-arrow.svg'); + } } diff --git a/res/img/element-icons/left-arrow.svg b/res/img/element-icons/left-arrow.svg new file mode 100644 index 0000000000..557efbebd2 --- /dev/null +++ b/res/img/element-icons/left-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/views/context_menus/MessageContextMenu.tsx b/src/components/views/context_menus/MessageContextMenu.tsx index 86e9d9cc30..f77ead6f76 100644 --- a/src/components/views/context_menus/MessageContextMenu.tsx +++ b/src/components/views/context_menus/MessageContextMenu.tsx @@ -155,6 +155,15 @@ export default class MessageContextMenu extends React.Component this.closeMenu(); }; + private onJumpToRelatedEventClick = (relatedEventId: string): void => { + dis.dispatch({ + action: "view_room", + room_id: this.props.mxEvent.getRoomId(), + event_id: relatedEventId, + highlighted: true, + }); + }; + private onReportEventClick = (): void => { dis.dispatch({ action: Action.OpenReportEventDialog, @@ -488,6 +497,18 @@ export default class MessageContextMenu extends React.Component ); } + let jumpToRelatedEventButton: JSX.Element; + const relatedEventId = mxEvent.getWireContent()?.["m.relates_to"]?.event_id; + if (relatedEventId) { + jumpToRelatedEventButton = ( + this.onJumpToRelatedEventClick(relatedEventId)} + /> + ); + } + let reportEventButton: JSX.Element; if (mxEvent.getSender() !== me) { reportEventButton = ( @@ -608,6 +629,7 @@ export default class MessageContextMenu extends React.Component { permalinkButton } { reportEventButton } { externalURLButton } + { jumpToRelatedEventButton } { unhidePreviewButton } { viewSourceButton } { resendReactionsButton } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index c7e7b9793d..9b82b120c3 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2922,6 +2922,7 @@ "Show preview": "Show preview", "Source URL": "Source URL", "Collapse reply thread": "Collapse reply thread", + "View related event": "View related event", "Report": "Report", "Copy link": "Copy link", "Forget": "Forget",