From 41eb69ecd1653d21391debe06ff3b0946e000d29 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 22 Sep 2020 16:34:43 -0500 Subject: [PATCH] Chats: report user from message, fixes #391 --- app/soapbox/actions/reports.js | 11 +++++++++++ .../features/chats/components/chat_message_list.js | 3 ++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/soapbox/actions/reports.js b/app/soapbox/actions/reports.js index a1214fc56..9328e0141 100644 --- a/app/soapbox/actions/reports.js +++ b/app/soapbox/actions/reports.js @@ -25,6 +25,17 @@ export function initReport(account, status) { }; }; +export function initReportById(accountId) { + return (dispatch, getState) => { + dispatch({ + type: REPORT_INIT, + account: getState().getIn(['accounts', accountId]), + }); + + dispatch(openModal('REPORT')); + }; +}; + export function cancelReport() { return { type: REPORT_CANCEL, diff --git a/app/soapbox/features/chats/components/chat_message_list.js b/app/soapbox/features/chats/components/chat_message_list.js index 37a7e8ab9..1247c404f 100644 --- a/app/soapbox/features/chats/components/chat_message_list.js +++ b/app/soapbox/features/chats/components/chat_message_list.js @@ -13,6 +13,7 @@ import { escape, throttle } from 'lodash'; import { MediaGallery } from 'soapbox/features/ui/util/async-components'; import Bundle from 'soapbox/features/ui/components/bundle'; import DropdownMenuContainer from 'soapbox/containers/dropdown_menu_container'; +import { initReportById } from 'soapbox/actions/reports'; const messages = defineMessages({ today: { id: 'chats.dividers.today', defaultMessage: 'Today' }, @@ -224,7 +225,7 @@ class ChatMessageList extends ImmutablePureComponent { handleReportUser = (userId) => { return () => { - console.log(`should report user ${userId}`); + this.props.dispatch(initReportById(userId)); }; }