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:
Alex Gleason
2022-04-03 18:09:27 +00:00
52 changed files with 2034 additions and 1639 deletions

View File

@@ -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,
};
};

View File

@@ -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 = () => {

View File

@@ -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') && (