From 113c931cdafd06147fe443b5b94c802710e519f0 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 24 Apr 2024 17:00:48 +0200 Subject: [PATCH] Fix follow request notifications not being displayed (#2695) --- .../containers/follow_request_container.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js b/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js index d66b24991d..ad87da84aa 100644 --- a/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js +++ b/app/javascript/flavours/glitch/features/notifications/containers/follow_request_container.js @@ -1,17 +1,28 @@ import { connect } from 'react-redux'; import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts'; +import { makeGetAccount } from 'flavours/glitch/selectors'; import FollowRequest from '../components/follow_request'; -const mapDispatchToProps = (dispatch, { account }) => ({ +const makeMapStateToProps = () => { + const getAccount = makeGetAccount(); + + const mapStateToProps = (state, props) => ({ + account: getAccount(state, props.id), + }); + + return mapStateToProps; +}; + +const mapDispatchToProps = (dispatch, { id }) => ({ onAuthorize () { - dispatch(authorizeFollowRequest(account.get('id'))); + dispatch(authorizeFollowRequest(id)); }, onReject () { - dispatch(rejectFollowRequest(account.get('id'))); + dispatch(rejectFollowRequest(id)); }, }); -export default connect(null, mapDispatchToProps)(FollowRequest); +export default connect(makeMapStateToProps, mapDispatchToProps)(FollowRequest);