Add moved account warning

This commit is contained in:
Thibaut Girka 2019-11-24 15:57:27 +01:00 committed by ThibG
parent b25665d2e8
commit 014c2cad21
2 changed files with 15 additions and 2 deletions

View File

@ -51,7 +51,7 @@ import {
} from 'flavours/glitch/util/async-components'; } from 'flavours/glitch/util/async-components';
import { HotKeys } from 'react-hotkeys'; import { HotKeys } from 'react-hotkeys';
import { me } from 'flavours/glitch/util/initial_state'; import { me } from 'flavours/glitch/util/initial_state';
import { defineMessages, injectIntl } from 'react-intl'; import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
// Dummy import, to make sure that <Status /> ends up in the application bundle. // Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles. // Without this it ends up in ~8 very commonly used bundles.
@ -72,6 +72,7 @@ const mapStateToProps = state => ({
unreadNotifications: state.getIn(['notifications', 'unread']), unreadNotifications: state.getIn(['notifications', 'unread']),
showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']), showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']),
hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']), hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']),
moved: state.getIn(['accounts', me, 'moved']),
}); });
const keyMap = { const keyMap = {
@ -254,6 +255,7 @@ class UI extends React.Component {
dropdownMenuIsOpen: PropTypes.bool, dropdownMenuIsOpen: PropTypes.bool,
unreadNotifications: PropTypes.number, unreadNotifications: PropTypes.number,
showFaviconBadge: PropTypes.bool, showFaviconBadge: PropTypes.bool,
moved: PropTypes.bool,
}; };
state = { state = {
@ -539,7 +541,7 @@ class UI extends React.Component {
render () { render () {
const { draggingOver } = this.state; const { draggingOver } = this.state;
const { children, layout, isWide, navbarUnder, location, dropdownMenuIsOpen } = this.props; const { children, layout, isWide, navbarUnder, location, dropdownMenuIsOpen, moved } = this.props;
const columnsClass = layout => { const columnsClass = layout => {
switch (layout) { switch (layout) {
@ -583,6 +585,9 @@ class UI extends React.Component {
return ( return (
<HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused> <HotKeys keyMap={keyMap} handlers={handlers} ref={this.setHotkeysRef} attach={window} focused>
<div className={className} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}> <div className={className} ref={this.setRef} style={{ pointerEvents: dropdownMenuIsOpen ? 'none' : null }}>
{moved && (<div className='flash-message alert'>
<FormattedMessage id='moved_to_warning' defaultMessage='This account is marked as moved to another account, and may thus not accept new follows.' />
</div>)}
<SwitchingColumnsArea location={location} layout={layout} navbarUnder={navbarUnder} onLayoutChange={this.handleLayoutChange}> <SwitchingColumnsArea location={location} layout={layout} navbarUnder={navbarUnder} onLayoutChange={this.handleLayoutChange}>
{children} {children}
</SwitchingColumnsArea> </SwitchingColumnsArea>

View File

@ -1556,6 +1556,14 @@
} }
} }
.ui .flash-message {
margin-top: 10px;
margin-left: auto;
margin-right: auto;
margin-bottom: 0;
min-width: 75%;
}
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
border-radius: 0; border-radius: 0;
} }