Add dropdown menu item to open admin interface for remote domains (#21895)
* Allow /admin/instances/:domain to handle IDNs * Add dropdown menu item to open admin interface for remote domains
This commit is contained in:
		
					parent
					
						
							
								bf5fc20858
							
						
					
				
			
			
				commit
				
					
						18d00055f4
					
				
			
		
					 5 changed files with 38 additions and 17 deletions
				
			
		|  | @ -8,7 +8,7 @@ import { defineMessages, injectIntl } from 'react-intl'; | |||
| import ImmutablePureComponent from 'react-immutable-pure-component'; | ||||
| import { me } from '../initial_state'; | ||||
| import classNames from 'classnames'; | ||||
| import { PERMISSION_MANAGE_USERS } from 'mastodon/permissions'; | ||||
| import { PERMISSION_MANAGE_USERS, PERMISSION_MANAGE_FEDERATION } from 'mastodon/permissions'; | ||||
| 
 | ||||
| const messages = defineMessages({ | ||||
|   delete: { id: 'status.delete', defaultMessage: 'Delete' }, | ||||
|  | @ -38,6 +38,7 @@ const messages = defineMessages({ | |||
|   embed: { id: 'status.embed', defaultMessage: 'Embed' }, | ||||
|   admin_account: { id: 'status.admin_account', defaultMessage: 'Open moderation interface for @{name}' }, | ||||
|   admin_status: { id: 'status.admin_status', defaultMessage: 'Open this post in the moderation interface' }, | ||||
|   admin_domain: { id: 'status.admin_domain', defaultMessage: 'Open moderation interface for {domain}' }, | ||||
|   copy: { id: 'status.copy', defaultMessage: 'Copy link to post' }, | ||||
|   hide: { id: 'status.hide', defaultMessage: 'Hide post' }, | ||||
|   blockDomain: { id: 'account.block_domain', defaultMessage: 'Block domain {domain}' }, | ||||
|  | @ -232,7 +233,7 @@ class StatusActionBar extends ImmutablePureComponent { | |||
| 
 | ||||
|   render () { | ||||
|     const { status, relationship, intl, withDismiss, withCounters, scrollKey } = this.props; | ||||
|     const { signedIn } = this.context.identity; | ||||
|     const { signedIn, permissions } = this.context.identity; | ||||
| 
 | ||||
|     const anonymousAccess    = !signedIn; | ||||
|     const publicStatus       = ['public', 'unlisted'].includes(status.get('visibility')); | ||||
|  | @ -312,10 +313,16 @@ class StatusActionBar extends ImmutablePureComponent { | |||
|         } | ||||
|       } | ||||
| 
 | ||||
|       if ((this.context.identity.permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) { | ||||
|       if ((permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS || (isRemote && (permissions & PERMISSION_MANAGE_FEDERATION) === PERMISSION_MANAGE_FEDERATION)) { | ||||
|         menu.push(null); | ||||
|         menu.push({ text: intl.formatMessage(messages.admin_account, { name: account.get('username') }), href: `/admin/accounts/${status.getIn(['account', 'id'])}` }); | ||||
|         menu.push({ text: intl.formatMessage(messages.admin_status), href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}` }); | ||||
|         if ((permissions & PERMISSION_MANAGE_USERS) === PERMISSION_MANAGE_USERS) { | ||||
|           menu.push({ text: intl.formatMessage(messages.admin_account, { name: account.get('username') }), href: `/admin/accounts/${status.getIn(['account', 'id'])}` }); | ||||
|           menu.push({ text: intl.formatMessage(messages.admin_status), href: `/admin/accounts/${status.getIn(['account', 'id'])}/statuses/${status.get('id')}` }); | ||||
|         } | ||||
|         if (isRemote && (permissions & PERMISSION_MANAGE_FEDERATION) === PERMISSION_MANAGE_FEDERATION) { | ||||
|           const domain = account.get('acct').split('@')[1]; | ||||
|           menu.push({ text: intl.formatMessage(messages.admin_domain, { domain: domain }), href: `/admin/instances/${domain}` }); | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue