From d9cfeb4f14b9ae1b01efd79c6e9c464fa4c17307 Mon Sep 17 00:00:00 2001 From: RossyB Date: Tue, 18 Feb 2020 14:14:28 +0200 Subject: [PATCH] NY-9340 [WEB] Clicking on a starred message on the dashboard should open the conversation --- .../StarredMessages/StarredMessages.js | 4 ++-- src/layouts/Dashboard/Dashboard.js | 22 +++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/componets/StarredMessages/StarredMessages.js b/src/componets/StarredMessages/StarredMessages.js index d2a74d09d..4f68bba4e 100644 --- a/src/componets/StarredMessages/StarredMessages.js +++ b/src/componets/StarredMessages/StarredMessages.js @@ -386,7 +386,7 @@ class StarredMessages extends Component { } render() { - const { classes, data, t } = this.props; + const { classes, data, t, openStarredMsg } = this.props; const { expanded, showPreview, previewFile, previewType, showShare, txtType } = this.state; const fileLink = this.getFileURL(previewFile); @@ -405,7 +405,7 @@ class StarredMessages extends Component {
- + openStarredMsg(message, data.isGroup)}> (stylesFunc(theme, avatarPic)); markAsRead: p2pActions.markAsRead, openToast: notificationActions.openMessageModal, closeToast: notificationActions.closeMessageModal, + getHistoryGroup: groupsHistoryActions.getHistoryRequest, + getDetailsGroup: roomListActions.getDetails, }, dispatch), groupActions: bindActionCreators({ ...groupsHistoryActions }, dispatch), acceptContact: bindActionCreators(contactsActions.acceptContact, dispatch), @@ -199,6 +202,7 @@ class Dashboard extends Component { t={t} openToast={this.props.actions.openToast} closeToast={this.props.actions.closeToast} + openStarredMsg={this.handleOpenStarredMsg} />
))); @@ -257,6 +261,24 @@ class Dashboard extends Component { this.props.router.push(link); }; + handleOpenStarredMsg = (msg, isGroup) => { + let convId; + const { actions, router, phoneId } = this.props; + const { from, to } = msg; + + if (isGroup) { + convId = to; + actions.getHistoryGroup(convId, 1, msg, true); + actions.getDetailsGroup({ id: convId }); + } else { + convId = phoneId === from ? to : from; + actions.getHistoryRequest(convId, 1, msg, true); + } + + router.push(`/starred/${convId}`); + }; + + render() { const { classes, actions, AllUnreadedP2P, AllUnreadedGroup, unreadP2P, unreadGroup, starredMessages, t, i18n } = this.props; const { openChat, openGroupChat, emptyContactReq, scheduledMessages, incommingRequests, openAddUserModal } = this.state; -- GitLab