forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add follow request banner on account header (mastodon#20785)
* Add requested_by to relationship maps * Display whether an account has requested to follow you on their profile
- Loading branch information
1 parent
7a3c6bb
commit 7041571
Showing
10 changed files
with
127 additions
and
4 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
app/javascript/mastodon/features/account/components/follow_request_note.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import ImmutablePureComponent from 'react-immutable-pure-component'; | ||
import Icon from 'mastodon/components/icon'; | ||
|
||
export default class FollowRequestNote extends ImmutablePureComponent { | ||
|
||
static propTypes = { | ||
account: ImmutablePropTypes.map.isRequired, | ||
}; | ||
|
||
render () { | ||
const { account, onAuthorize, onReject } = this.props; | ||
|
||
return ( | ||
<div className='follow-request-banner'> | ||
<div className='follow-request-banner__message'> | ||
<FormattedMessage id='account.requested_follow' defaultMessage='{name} has requested to follow you' values={{ name: <bdi><strong dangerouslySetInnerHTML={{ __html: account.get('display_name_html') }} /></bdi> }} /> | ||
</div> | ||
|
||
<div className='follow-request-banner__action'> | ||
<button type='button' className='button button-tertiary button--confirmation' onClick={onAuthorize}> | ||
<Icon id='check' fixedWidth /> | ||
<FormattedMessage id='follow_request.authorize' defaultMessage='Authorize' /> | ||
</button> | ||
|
||
<button type='button' className='button button-tertiary button--destructive' onClick={onReject}> | ||
<Icon id='times' fixedWidth /> | ||
<FormattedMessage id='follow_request.reject' defaultMessage='Reject' /> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
app/javascript/mastodon/features/account/containers/follow_request_note_container.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { connect } from 'react-redux'; | ||
import FollowRequestNote from '../components/follow_request_note'; | ||
import { authorizeFollowRequest, rejectFollowRequest } from 'mastodon/actions/accounts'; | ||
|
||
const mapDispatchToProps = (dispatch, { account }) => ({ | ||
onAuthorize () { | ||
dispatch(authorizeFollowRequest(account.get('id'))); | ||
}, | ||
|
||
onReject () { | ||
dispatch(rejectFollowRequest(account.get('id'))); | ||
}, | ||
}); | ||
|
||
export default connect(null, mapDispatchToProps)(FollowRequestNote); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters