From 852a79cee83bfc93dd5aa7f71a315c7fa08ca64b Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 9 Sep 2021 19:55:36 +0100 Subject: [PATCH 1/5] Add jump to related event context menu item --- .../context_menus/_MessageContextMenu.scss | 4 ++++ .../context_menus/MessageContextMenu.tsx | 22 +++++++++++++++++++ src/i18n/strings/en_EN.json | 1 + 3 files changed, 27 insertions(+) diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index 5af748e28d1..cd565a77a6f 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -81,4 +81,8 @@ limitations under the License. .mx_MessageContextMenu_iconUnpin::before { mask-image: url('$(res)/img/element-icons/room/pin.svg'); } + + .mx_MessageContextMenu_jumpToEvent::before { + mask-image: url('$(res)/img/element-icons/link.svg'); + } } diff --git a/src/components/views/context_menus/MessageContextMenu.tsx b/src/components/views/context_menus/MessageContextMenu.tsx index 8f5d3baa170..4188825d67b 100644 --- a/src/components/views/context_menus/MessageContextMenu.tsx +++ b/src/components/views/context_menus/MessageContextMenu.tsx @@ -123,6 +123,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 => { Modal.createTrackedDialog('Report Event', '', ReportEventDialog, { mxEvent: this.props.mxEvent, @@ -392,6 +401,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 = ( @@ -411,6 +432,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 f3ae9424e07..449778541bf 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2643,6 +2643,7 @@ "Show preview": "Show preview", "Source URL": "Source URL", "Collapse reply thread": "Collapse reply thread", + "Jump to relation": "Jump to relation", "Report": "Report", "Add space": "Add space", "Manage & explore rooms": "Manage & explore rooms", From fc3b858d69c7915409f6c62bf7e8073b19a1afa0 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 19 May 2022 13:56:22 +0100 Subject: [PATCH 2/5] Update jump to event icon --- res/css/views/context_menus/_MessageContextMenu.scss | 2 +- res/img/left-arrow.svg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 res/img/left-arrow.svg diff --git a/res/css/views/context_menus/_MessageContextMenu.scss b/res/css/views/context_menus/_MessageContextMenu.scss index 0cdcd825ac8..dde68e8bad2 100644 --- a/res/css/views/context_menus/_MessageContextMenu.scss +++ b/res/css/views/context_menus/_MessageContextMenu.scss @@ -111,6 +111,6 @@ limitations under the License. } .mx_MessageContextMenu_jumpToEvent::before { - mask-image: url('$(res)/img/element-icons/link.svg'); + mask-image: url('$(res)/img/element-icons/left-arrow.svg'); } } diff --git a/res/img/left-arrow.svg b/res/img/left-arrow.svg new file mode 100644 index 00000000000..557efbebd2f --- /dev/null +++ b/res/img/left-arrow.svg @@ -0,0 +1 @@ + \ No newline at end of file From 5a2eb6b705da60f704d7379a21c8b4cfe36388af Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 19 May 2022 13:58:05 +0100 Subject: [PATCH 3/5] Updte copy --- src/components/views/context_menus/MessageContextMenu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/context_menus/MessageContextMenu.tsx b/src/components/views/context_menus/MessageContextMenu.tsx index 63eb5915a5a..f77ead6f763 100644 --- a/src/components/views/context_menus/MessageContextMenu.tsx +++ b/src/components/views/context_menus/MessageContextMenu.tsx @@ -503,7 +503,7 @@ export default class MessageContextMenu extends React.Component jumpToRelatedEventButton = ( this.onJumpToRelatedEventClick(relatedEventId)} /> ); From 54dd38ab4d701135877e4cecce306c179493c18b Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 19 May 2022 14:21:00 +0100 Subject: [PATCH 4/5] i18n fix --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 0d075b8247d..9b82b120c32 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -2922,7 +2922,7 @@ "Show preview": "Show preview", "Source URL": "Source URL", "Collapse reply thread": "Collapse reply thread", - "Jump to relation": "Jump to relation", + "View related event": "View related event", "Report": "Report", "Copy link": "Copy link", "Forget": "Forget", From e96d70d51f4e54db1715aa798e8de32fd33415a8 Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Thu, 19 May 2022 14:43:51 +0100 Subject: [PATCH 5/5] Move left arrow icon --- res/img/{ => element-icons}/left-arrow.svg | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename res/img/{ => element-icons}/left-arrow.svg (100%) diff --git a/res/img/left-arrow.svg b/res/img/element-icons/left-arrow.svg similarity index 100% rename from res/img/left-arrow.svg rename to res/img/element-icons/left-arrow.svg