Merge branch 'next-emoji-reacts' into 'next'
Next: emoji reacts part 1 See merge request soapbox-pub/soapbox-fe!1161
This commit is contained in:
@@ -18,12 +18,8 @@ import StillImage from 'soapbox/components/still_image';
|
||||
import { HStack, IconButton, Menu, MenuButton, MenuItem, MenuList, MenuLink, MenuDivider } from 'soapbox/components/ui';
|
||||
import ActionButton from 'soapbox/features/ui/components/action_button';
|
||||
import {
|
||||
isStaff,
|
||||
isAdmin,
|
||||
isModerator,
|
||||
isLocal,
|
||||
isRemote,
|
||||
getDomain,
|
||||
} from 'soapbox/utils/accounts';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
|
||||
@@ -322,7 +318,7 @@ class Header extends ImmutablePureComponent {
|
||||
}
|
||||
|
||||
if (isRemote(account)) {
|
||||
const domain = getDomain(account);
|
||||
const domain = account.fqn.split('@')[1];
|
||||
|
||||
menu.push(null);
|
||||
|
||||
@@ -341,10 +337,10 @@ class Header extends ImmutablePureComponent {
|
||||
}
|
||||
}
|
||||
|
||||
if (isStaff(meAccount)) {
|
||||
if (meAccount.staff) {
|
||||
menu.push(null);
|
||||
|
||||
if (isAdmin(meAccount)) {
|
||||
if (meAccount.admin) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.admin_account, { name: account.get('username') }),
|
||||
to: `/pleroma/admin/#/users/${account.id}/`,
|
||||
@@ -353,8 +349,8 @@ class Header extends ImmutablePureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (account.get('id') !== me && isLocal(account) && isAdmin(meAccount)) {
|
||||
if (isAdmin(account)) {
|
||||
if (account.id !== me && isLocal(account) && meAccount.admin) {
|
||||
if (account.admin) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.demoteToModerator, { name: account.get('username') }),
|
||||
action: this.props.onPromoteToModerator,
|
||||
@@ -365,7 +361,7 @@ class Header extends ImmutablePureComponent {
|
||||
action: this.props.onDemoteToUser,
|
||||
icon: require('@tabler/icons/icons/arrow-down-circle.svg'),
|
||||
});
|
||||
} else if (isModerator(account)) {
|
||||
} else if (account.moderator) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.promoteToAdmin, { name: account.get('username') }),
|
||||
action: this.props.onPromoteToAdmin,
|
||||
@@ -404,7 +400,7 @@ class Header extends ImmutablePureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
if (features.suggestionsV2 && isAdmin(meAccount)) {
|
||||
if (features.suggestionsV2 && meAccount.admin) {
|
||||
if (account.getIn(['pleroma', 'is_suggested'])) {
|
||||
menu.push({
|
||||
text: intl.formatMessage(messages.unsuggestUser, { name: account.get('username') }),
|
||||
|
||||
@@ -37,7 +37,6 @@ import { initReport } from 'soapbox/actions/reports';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import { makeGetAccount } from 'soapbox/selectors';
|
||||
import { isAdmin } from 'soapbox/utils/accounts';
|
||||
|
||||
import Header from '../components/header';
|
||||
|
||||
@@ -216,7 +215,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
||||
},
|
||||
|
||||
onPromoteToModerator(account) {
|
||||
const messageType = isAdmin(account) ? messages.demotedToModerator : messages.promotedToModerator;
|
||||
const messageType = account.admin ? messages.demotedToModerator : messages.promotedToModerator;
|
||||
const message = intl.formatMessage(messageType, { acct: account.get('acct') });
|
||||
|
||||
dispatch(promoteToModerator(account.get('id')))
|
||||
|
||||
@@ -7,7 +7,6 @@ import { connect } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { getSubscribersCsv, getUnsubscribersCsv, getCombinedCsv } from 'soapbox/actions/email_list';
|
||||
import { isAdmin } from 'soapbox/utils/accounts';
|
||||
import sourceCode from 'soapbox/utils/code';
|
||||
import { parseVersion } from 'soapbox/utils/features';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
@@ -139,7 +138,7 @@ class Dashboard extends ImmutablePureComponent {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{isAdmin(account) && <RegistrationModePicker />}
|
||||
{account.admin && <RegistrationModePicker />}
|
||||
<div className='dashwidgets'>
|
||||
<div className='dashwidget'>
|
||||
<h4><FormattedMessage id='admin.dashwidgets.software_header' defaultMessage='Software' /></h4>
|
||||
@@ -148,7 +147,7 @@ class Dashboard extends ImmutablePureComponent {
|
||||
<li>{v.software} <span className='pull-right'>{v.version}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
{supportsEmailList && isAdmin(account) && <div className='dashwidget'>
|
||||
{supportsEmailList && account.admin && <div className='dashwidget'>
|
||||
<h4><FormattedMessage id='admin.dashwidgets.email_list_header' defaultMessage='Email list' /></h4>
|
||||
<ul>
|
||||
<li><a href='#' onClick={this.handleSubscribersClick} target='_blank'>subscribers.csv</a></li>
|
||||
|
||||
@@ -7,7 +7,6 @@ import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import { isUserTouching } from 'soapbox/is_mobile';
|
||||
import { isStaff, isAdmin } from 'soapbox/utils/accounts';
|
||||
import { getReactForStatus } from 'soapbox/utils/emoji_reacts';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types';
|
||||
@@ -65,8 +64,8 @@ const mapStateToProps = state => {
|
||||
|
||||
return {
|
||||
me,
|
||||
isStaff: account ? isStaff(account) : false,
|
||||
isAdmin: account ? isAdmin(account) : false,
|
||||
isStaff: account ? account.staff : false,
|
||||
isAdmin: account ? account.admin : false,
|
||||
features: getFeatures(instance),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,7 +11,6 @@ import { openModal } from 'soapbox/actions/modals';
|
||||
import DropdownMenu from 'soapbox/containers/dropdown_menu_container';
|
||||
import InstanceRestrictions from 'soapbox/features/federation_restrictions/components/instance_restrictions';
|
||||
import { makeGetRemoteInstance } from 'soapbox/selectors';
|
||||
import { isAdmin } from 'soapbox/utils/accounts';
|
||||
|
||||
const getRemoteInstance = makeGetRemoteInstance();
|
||||
|
||||
@@ -20,13 +19,13 @@ const messages = defineMessages({
|
||||
});
|
||||
|
||||
const mapStateToProps = (state, { host }) => {
|
||||
const me = state.get('me');
|
||||
const account = state.getIn(['accounts', me]);
|
||||
const { me, instance } = state;
|
||||
const account = state.accounts.get(me);
|
||||
|
||||
return {
|
||||
instance: state.get('instance'),
|
||||
instance,
|
||||
remoteInstance: getRemoteInstance(state, host),
|
||||
isAdmin: isAdmin(account),
|
||||
isAdmin: account.admin,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
||||
import { Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { makeGetAccount } from 'soapbox/selectors';
|
||||
import { isStaff } from 'soapbox/utils/accounts';
|
||||
|
||||
import Account from '../../../components/account';
|
||||
|
||||
@@ -31,7 +30,7 @@ type IMenuItem = {
|
||||
action?: (event: React.MouseEvent) => void
|
||||
}
|
||||
|
||||
const getAccount: any = makeGetAccount();
|
||||
const getAccount = makeGetAccount();
|
||||
|
||||
const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
|
||||
const dispatch = useDispatch();
|
||||
@@ -40,7 +39,7 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
|
||||
const me = useAppSelector((state) => state.me);
|
||||
const currentAccount = useAppSelector((state) => getAccount(state, me));
|
||||
const authUsers = useAppSelector((state) => state.auth.get('users'));
|
||||
const isCurrentAccountStaff = isStaff(currentAccount) || false;
|
||||
const isCurrentAccountStaff = Boolean(currentAccount?.staff);
|
||||
const otherAccounts = useAppSelector((state) => authUsers.map((authUser: any) => getAccount(state, authUser.get('id'))));
|
||||
|
||||
const handleLogOut = () => {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { initAccountNoteModal } from 'soapbox/actions/account_notes';
|
||||
import Badge from 'soapbox/components/badge';
|
||||
import { Icon, HStack, Stack, Text } from 'soapbox/components/ui';
|
||||
import VerificationBadge from 'soapbox/components/verification_badge';
|
||||
import { getAcct, isAdmin, isModerator, isLocal } from 'soapbox/utils/accounts';
|
||||
import { isLocal } from 'soapbox/utils/accounts';
|
||||
import { displayFqn } from 'soapbox/utils/state';
|
||||
|
||||
import ProfileStats from './profile_stats';
|
||||
@@ -48,9 +48,9 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
||||
getStaffBadge = () => {
|
||||
const { account } = this.props;
|
||||
|
||||
if (isAdmin(account)) {
|
||||
if (account?.admin) {
|
||||
return <Badge slug='admin' title='Admin' key='staff' />;
|
||||
} else if (isModerator(account)) {
|
||||
} else if (account?.moderator) {
|
||||
return <Badge slug='moderator' title='Moderator' key='staff' />;
|
||||
} else {
|
||||
return null;
|
||||
@@ -155,7 +155,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
||||
|
||||
{verified && <VerificationBadge />}
|
||||
|
||||
{account.get('bot') && <Badge slug='bot' title={intl.formatMessage(messages.bot)} />}
|
||||
{account.bot && <Badge slug='bot' title={intl.formatMessage(messages.bot)} />}
|
||||
|
||||
{badges.length > 0 && (
|
||||
<HStack space={1} alignItems='center'>
|
||||
@@ -166,7 +166,7 @@ class ProfileInfoPanel extends ImmutablePureComponent {
|
||||
|
||||
<HStack alignItems='center' space={0.5}>
|
||||
<Text size='sm' theme='muted'>
|
||||
@{getAcct(account, displayFqn)}
|
||||
@{displayFqn ? account.fqn : account.acct}
|
||||
</Text>
|
||||
|
||||
{account.get('locked') && (
|
||||
|
||||
@@ -26,7 +26,6 @@ import HomePage from 'soapbox/pages/home_page';
|
||||
import ProfilePage from 'soapbox/pages/profile_page';
|
||||
import RemoteInstancePage from 'soapbox/pages/remote_instance_page';
|
||||
import StatusPage from 'soapbox/pages/status_page';
|
||||
import { isStaff, isAdmin } from 'soapbox/utils/accounts';
|
||||
import { getAccessToken } from 'soapbox/utils/auth';
|
||||
import { getVapidKey } from 'soapbox/utils/auth';
|
||||
import { getFeatures } from 'soapbox/utils/features';
|
||||
@@ -495,12 +494,12 @@ class UI extends React.PureComponent {
|
||||
dispatch(fetchChats());
|
||||
}
|
||||
|
||||
if (isStaff(account)) {
|
||||
if (account.staff) {
|
||||
dispatch(fetchReports({ state: 'open' }));
|
||||
dispatch(fetchUsers(['local', 'need_approval']));
|
||||
}
|
||||
|
||||
if (isAdmin(account)) {
|
||||
if (account.admin) {
|
||||
dispatch(fetchConfig());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ import { connect } from 'react-redux';
|
||||
import { Redirect, Route } from 'react-router-dom';
|
||||
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import { isStaff, isAdmin } from 'soapbox/utils/accounts';
|
||||
|
||||
import BundleColumnError from '../components/bundle_column_error';
|
||||
import ColumnForbidden from '../components/column_forbidden';
|
||||
@@ -111,8 +110,8 @@ class WrappedRoute extends React.Component {
|
||||
const authorized = [
|
||||
account || publicRoute,
|
||||
developerOnly ? settings.get('isDeveloper') : true,
|
||||
staffOnly ? account && isStaff(account) : true,
|
||||
adminOnly ? account && isAdmin(account) : true,
|
||||
staffOnly ? account && account.staff : true,
|
||||
adminOnly ? account && account.admin : true,
|
||||
].every(c => c);
|
||||
|
||||
if (!authorized) {
|
||||
|
||||
Reference in New Issue
Block a user