Fix follow request notifications not being displayed (#2695)

pull/2698/head
Claire 2024-04-24 17:00:48 +02:00 committed by GitHub
parent b79df709a8
commit 113c931cda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 4 deletions

View File

@ -1,17 +1,28 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts'; import { authorizeFollowRequest, rejectFollowRequest } from 'flavours/glitch/actions/accounts';
import { makeGetAccount } from 'flavours/glitch/selectors';
import FollowRequest from '../components/follow_request'; 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 () { onAuthorize () {
dispatch(authorizeFollowRequest(account.get('id'))); dispatch(authorizeFollowRequest(id));
}, },
onReject () { onReject () {
dispatch(rejectFollowRequest(account.get('id'))); dispatch(rejectFollowRequest(id));
}, },
}); });
export default connect(null, mapDispatchToProps)(FollowRequest); export default connect(makeMapStateToProps, mapDispatchToProps)(FollowRequest);