diff options
author | ThibG <thib@sitedethib.com> | 2018-03-30 12:38:00 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-03-30 12:38:00 +0200 |
commit | a6c129ddbdaaa84bc631d85eb248fb5a9fa7eb96 (patch) | |
tree | e086d17c19330bb475595ef27e7e9f471968b810 /app/javascript/mastodon/components/domain.js | |
parent | 47cee7cc8e47471b372630cd28d50c6284aad8b3 (diff) |
Add some UI for user-defined domain blocks (#6628)
* Keep list of blocked domains Might be overkill, but I'm trying to follow the same logic as for blocked users * Add basic domain block UI * Add the domain blocks UI to Getting Started * Fix undefined URL in `fetchDomainBlocks` * Update all known users' domain_blocking relationship instead of just one's
Diffstat (limited to 'app/javascript/mastodon/components/domain.js')
-rw-r--r-- | app/javascript/mastodon/components/domain.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/domain.js b/app/javascript/mastodon/components/domain.js new file mode 100644 index 000000000..f657cb8d2 --- /dev/null +++ b/app/javascript/mastodon/components/domain.js @@ -0,0 +1,42 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import IconButton from './icon_button'; +import { defineMessages, injectIntl } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; + +const messages = defineMessages({ + unblockDomain: { id: 'account.unblock_domain', defaultMessage: 'Unhide {domain}' }, +}); + +@injectIntl +export default class Account extends ImmutablePureComponent { + + static propTypes = { + domain: PropTypes.string, + onUnblockDomain: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + }; + + handleDomainUnblock = () => { + this.props.onUnblockDomain(this.props.domain); + } + + render () { + const { domain, intl } = this.props; + + return ( + <div className='domain'> + <div className='domain__wrapper'> + <span className='domain__domain-name'> + <strong>{domain}</strong> + </span> + + <div className='domain__buttons'> + <IconButton active icon='unlock-alt' title={intl.formatMessage(messages.unblockDomain, { domain })} onClick={this.handleDomainUnblock} /> + </div> + </div> + </div> + ); + } + +} |