diff --git a/app/soapbox/actions/domain_blocks.js b/app/soapbox/actions/domain_blocks.js index 92824a55c..4597f1afa 100644 --- a/app/soapbox/actions/domain_blocks.js +++ b/app/soapbox/actions/domain_blocks.js @@ -142,7 +142,7 @@ export function expandDomainBlocks() { return (dispatch, getState) => { if (!isLoggedIn(getState)) return; - const url = getState().getIn(['domain_lists', 'blocks', 'next']); + const url = getState().domain_lists.blocks.next; if (!url) { return; diff --git a/app/soapbox/components/dropdown_menu.tsx b/app/soapbox/components/dropdown_menu.tsx index cf4b09b7c..d56a72a01 100644 --- a/app/soapbox/components/dropdown_menu.tsx +++ b/app/soapbox/components/dropdown_menu.tsx @@ -249,7 +249,7 @@ export interface IDropdown extends RouteComponentProps { ) => void, onClose?: (id: number) => void, dropdownPlacement?: string, - openDropdownId?: number, + openDropdownId?: number | null, openedViaKeyboard?: boolean, text?: string, onShiftClick?: React.EventHandler, diff --git a/app/soapbox/components/profile-hover-card.tsx b/app/soapbox/components/profile-hover-card.tsx index 9c9f2e79a..8e5e281bd 100644 --- a/app/soapbox/components/profile-hover-card.tsx +++ b/app/soapbox/components/profile-hover-card.tsx @@ -92,7 +92,7 @@ export const ProfileHoverCard: React.FC = ({ visible = true } if (!account) return null; const accountBio = { __html: account.note_emojified }; - const followedBy = me !== account.id && account.relationship.get('followed_by') === true; + const followedBy = me !== account.id && account.relationship?.followed_by === true; return (
, + (status.pleroma.get('emoji_reactions') || ImmutableList()) as ImmutableList, favouriteCount, status.favourited, allowedEmoji, diff --git a/app/soapbox/containers/account_container.js b/app/soapbox/containers/account_container.js index 78abcdea8..9b65f3b10 100644 --- a/app/soapbox/containers/account_container.js +++ b/app/soapbox/containers/account_container.js @@ -35,7 +35,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ onFollow(account) { dispatch((_, getState) => { const unfollowModal = getSettings(getState()).get('unfollowModal'); - if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { + if (account.relationship?.following || account.relationship?.requested) { if (unfollowModal) { dispatch(openModal('CONFIRM', { icon: require('@tabler/icons/icons/minus.svg'), @@ -54,7 +54,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onBlock(account) { - if (account.getIn(['relationship', 'blocking'])) { + if (account.relationship?.blocking) { dispatch(unblockAccount(account.get('id'))); } else { dispatch(blockAccount(account.get('id'))); @@ -62,7 +62,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onMute(account) { - if (account.getIn(['relationship', 'muting'])) { + if (account.relationship?.muting) { dispatch(unmuteAccount(account.get('id'))); } else { dispatch(initMuteModal(account)); diff --git a/app/soapbox/containers/dropdown_menu_container.ts b/app/soapbox/containers/dropdown_menu_container.ts index fa149d0f4..d3e7149e4 100644 --- a/app/soapbox/containers/dropdown_menu_container.ts +++ b/app/soapbox/containers/dropdown_menu_container.ts @@ -11,9 +11,9 @@ import type { RootState } from 'soapbox/store'; const mapStateToProps = (state: RootState) => ({ isModalOpen: Boolean(state.modals.size && state.modals.last().modalType === 'ACTIONS'), - dropdownPlacement: state.dropdown_menu.get('placement'), - openDropdownId: state.dropdown_menu.get('openId'), - openedViaKeyboard: state.dropdown_menu.get('keyboard'), + dropdownPlacement: state.dropdown_menu.placement, + openDropdownId: state.dropdown_menu.openId, + openedViaKeyboard: state.dropdown_menu.keyboard, }); const mapDispatchToProps = (dispatch: Dispatch, { status, items }: Partial) => ({ diff --git a/app/soapbox/features/account/components/header.js b/app/soapbox/features/account/components/header.js index b6fe013a7..b76a156a5 100644 --- a/app/soapbox/features/account/components/header.js +++ b/app/soapbox/features/account/components/header.js @@ -235,8 +235,8 @@ class Header extends ImmutablePureComponent { // }); // } - if (account.getIn(['relationship', 'following'])) { - if (account.getIn(['relationship', 'showing_reblogs'])) { + if (account.relationship?.following) { + if (account.relationship?.showing_reblogs) { menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle, @@ -251,7 +251,7 @@ class Header extends ImmutablePureComponent { } if (features.accountSubscriptions) { - if (account.getIn(['relationship', 'subscribing'])) { + if (account.relationship?.subscribing) { menu.push({ text: intl.formatMessage(messages.unsubscribe, { name: account.get('username') }), action: this.props.onSubscriptionToggle, @@ -274,7 +274,7 @@ class Header extends ImmutablePureComponent { }); } - // menu.push({ text: intl.formatMessage(account.getIn(['relationship', 'endorsed']) ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle }); + // menu.push({ text: intl.formatMessage(account.relationship?.endorsed ? messages.unendorse : messages.endorse), action: this.props.onEndorseToggle }); menu.push(null); } else if (features.lists && features.unrestrictedLists) { menu.push({ @@ -284,7 +284,7 @@ class Header extends ImmutablePureComponent { }); } - if (features.removeFromFollowers && account.getIn(['relationship', 'followed_by'])) { + if (features.removeFromFollowers && account.relationship?.followed_by) { menu.push({ text: intl.formatMessage(messages.removeFromFollowers), action: this.props.onRemoveFromFollowers, @@ -292,7 +292,7 @@ class Header extends ImmutablePureComponent { }); } - if (account.getIn(['relationship', 'muting'])) { + if (account.relationship?.muting) { menu.push({ text: intl.formatMessage(messages.unmute, { name: account.get('username') }), action: this.props.onMute, @@ -306,7 +306,7 @@ class Header extends ImmutablePureComponent { }); } - if (account.getIn(['relationship', 'blocking'])) { + if (account.relationship?.blocking) { menu.push({ text: intl.formatMessage(messages.unblock, { name: account.get('username') }), action: this.props.onBlock, @@ -332,7 +332,7 @@ class Header extends ImmutablePureComponent { menu.push(null); - if (account.getIn(['relationship', 'domain_blocking'])) { + if (account.relationship?.domain_blocking) { menu.push({ text: intl.formatMessage(messages.unblockDomain, { domain }), action: this.props.onUnblockDomain, @@ -463,7 +463,7 @@ class Header extends ImmutablePureComponent { if (!account || !me) return info; - if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) { + if (me !== account.get('id') && account.relationship?.followed_by) { info.push( } />, ); - } else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) { + } else if (me !== account.get('id') && account.relationship?.blocking) { info.push( } />, ); - } else if (me !== account.get('id') && account.getIn(['relationship', 'domain_blocking'])) { + } else if (me !== account.get('id') && account.relationship?.domain_blocking) { info.push( ({ onFollow(account) { dispatch((_, getState) => { const unfollowModal = getSettings(getState()).get('unfollowModal'); - if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { + if (account.relationship?.following || account.relationship?.requested) { if (unfollowModal) { dispatch(openModal('CONFIRM', { message: @{account.get('acct')} }} />, @@ -92,7 +92,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onBlock(account) { - if (account.getIn(['relationship', 'blocking'])) { + if (account.relationship?.blocking) { dispatch(unblockAccount(account.get('id'))); } else { dispatch(openModal('CONFIRM', { @@ -119,7 +119,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onReblogToggle(account) { - if (account.getIn(['relationship', 'showing_reblogs'])) { + if (account.relationship?.showing_reblogs) { dispatch(followAccount(account.get('id'), { reblogs: false })); } else { dispatch(followAccount(account.get('id'), { reblogs: true })); @@ -127,7 +127,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onSubscriptionToggle(account) { - if (account.getIn(['relationship', 'subscribing'])) { + if (account.relationship?.subscribing) { dispatch(unsubscribeAccount(account.get('id'))); } else { dispatch(subscribeAccount(account.get('id'))); @@ -135,7 +135,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onNotifyToggle(account) { - if (account.getIn(['relationship', 'notifying'])) { + if (account.relationship?.notifying) { dispatch(followAccount(account.get('id'), { notify: false })); } else { dispatch(followAccount(account.get('id'), { notify: true })); @@ -143,7 +143,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onEndorseToggle(account) { - if (account.getIn(['relationship', 'endorsed'])) { + if (account.relationship?.endorsed) { dispatch(unpinAccount(account.get('id'))); } else { dispatch(pinAccount(account.get('id'))); @@ -155,7 +155,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ }, onMute(account) { - if (account.getIn(['relationship', 'muting'])) { + if (account.relationship?.muting) { dispatch(unmuteAccount(account.get('id'))); } else { dispatch(initMuteModal(account)); diff --git a/app/soapbox/features/admin/components/report_status.tsx b/app/soapbox/features/admin/components/report_status.tsx index c882f0f5a..7503675e4 100644 --- a/app/soapbox/features/admin/components/report_status.tsx +++ b/app/soapbox/features/admin/components/report_status.tsx @@ -39,7 +39,7 @@ const ReportStatus: React.FC = ({ status }) => { return [{ text: intl.formatMessage(messages.viewStatus, { acct: `@${acct}` }), - to: `/@${acct}/posts/${status.get('id')}`, + to: `/@${acct}/posts/${status.id}`, icon: require('@tabler/icons/icons/pencil.svg'), }, { text: intl.formatMessage(messages.deleteStatus, { acct: `@${acct}` }), diff --git a/app/soapbox/features/admin/moderation_log.tsx b/app/soapbox/features/admin/moderation_log.tsx index 83163a382..b7a9bce2e 100644 --- a/app/soapbox/features/admin/moderation_log.tsx +++ b/app/soapbox/features/admin/moderation_log.tsx @@ -7,8 +7,6 @@ import { useAppDispatch, useAppSelector } from 'soapbox/hooks'; import Column from '../ui/components/column'; -import type { Map as ImmutableMap } from 'immutable'; - const messages = defineMessages({ heading: { id: 'column.admin.moderation_log', defaultMessage: 'Moderation Log' }, emptyMessage: { id: 'admin.moderation_log.empty_message', defaultMessage: 'You have not performed any moderation actions yet. When you do, a history will be shown here.' }, @@ -18,8 +16,10 @@ const ModerationLog = () => { const intl = useIntl(); const dispatch = useAppDispatch(); - const items = useAppSelector((state) => state.admin_log.get('index').map((i: number) => state.admin_log.getIn(['items', String(i)]))) as ImmutableMap; - const hasMore = useAppSelector((state) => state.admin_log.get('total', 0) - state.admin_log.get('index').count() > 0); + const items = useAppSelector((state) => { + return state.admin_log.index.map((i) => state.admin_log.items.get(String(i))); + }); + const hasMore = useAppSelector((state) => state.admin_log.total - state.admin_log.index.count() > 0); const [isLoading, setIsLoading] = useState(true); const [lastPage, setLastPage] = useState(0); @@ -56,12 +56,12 @@ const ModerationLog = () => { hasMore={hasMore} onLoadMore={handleLoadMore} > - {items.map((item, i) => ( -
-
{item.get('message')}
+ {items.map((item) => item && ( +
+
{item.message}
{ const dispatch = useDispatch(); const intl = useIntl(); - const value = useAppSelector(state => state.aliases.getIn(['suggestions', 'value'])) as string; + const value = useAppSelector(state => state.aliases.suggestions.value); const handleChange = (e: React.ChangeEvent) => { dispatch(changeAliasesSuggestions(e.target.value)); diff --git a/app/soapbox/features/aliases/index.tsx b/app/soapbox/features/aliases/index.tsx index 1e1484c83..20ced8951 100644 --- a/app/soapbox/features/aliases/index.tsx +++ b/app/soapbox/features/aliases/index.tsx @@ -35,11 +35,11 @@ const Aliases = () => { const instance = state.instance; const features = getFeatures(instance); - if (features.accountMoving) return state.aliases.getIn(['aliases', 'items'], ImmutableList()); + if (features.accountMoving) return state.aliases.aliases.items; return account!.pleroma.get('also_known_as'); }) as ImmutableList; - const searchAccountIds = useAppSelector((state) => state.aliases.getIn(['suggestions', 'items'])) as ImmutableList; - const loaded = useAppSelector((state) => state.aliases.getIn(['suggestions', 'loaded'])); + const searchAccountIds = useAppSelector((state) => state.aliases.suggestions.items); + const loaded = useAppSelector((state) => state.aliases.suggestions.loaded); useEffect(() => { dispatch(fetchAliases); diff --git a/app/soapbox/features/bookmarks/index.tsx b/app/soapbox/features/bookmarks/index.tsx index 0b1255f32..343d7ffc6 100644 --- a/app/soapbox/features/bookmarks/index.tsx +++ b/app/soapbox/features/bookmarks/index.tsx @@ -20,9 +20,9 @@ const Bookmarks: React.FC = () => { const dispatch = useAppDispatch(); const intl = useIntl(); - const statusIds = useAppSelector((state) => state.status_lists.getIn(['bookmarks', 'items'])); - const isLoading = useAppSelector((state) => state.status_lists.getIn(['bookmarks', 'isLoading'], true)); - const hasMore = useAppSelector((state) => !!state.status_lists.getIn(['bookmarks', 'next'])); + const statusIds = useAppSelector((state) => state.status_lists.get('bookmarks')!.items); + const isLoading = useAppSelector((state) => state.status_lists.get('bookmarks')!.isLoading); + const hasMore = useAppSelector((state) => !!state.status_lists.get('bookmarks')!.next); React.useEffect(() => { dispatch(fetchBookmarkedStatuses()); @@ -43,7 +43,7 @@ const Bookmarks: React.FC = () => { statusIds={statusIds} scrollKey='bookmarked_statuses' hasMore={hasMore} - isLoading={isLoading} + isLoading={typeof isLoading === 'boolean' ? isLoading : true} onLoadMore={() => handleLoadMore(dispatch)} onRefresh={handleRefresh} emptyMessage={emptyMessage} diff --git a/app/soapbox/features/directory/components/account_card.tsx b/app/soapbox/features/directory/components/account_card.tsx index 0b5a74b8b..991461f41 100644 --- a/app/soapbox/features/directory/components/account_card.tsx +++ b/app/soapbox/features/directory/components/account_card.tsx @@ -26,7 +26,7 @@ const AccountCard: React.FC = ({ id }) => { if (!account) return null; - const followedBy = me !== account.id && account.relationship.get('followed_by'); + const followedBy = me !== account.id && account.relationship?.followed_by; return (
diff --git a/app/soapbox/features/domain_blocks/index.tsx b/app/soapbox/features/domain_blocks/index.tsx index 712a6671f..88ddc1a12 100644 --- a/app/soapbox/features/domain_blocks/index.tsx +++ b/app/soapbox/features/domain_blocks/index.tsx @@ -24,8 +24,8 @@ const DomainBlocks: React.FC = () => { const dispatch = useDispatch(); const intl = useIntl(); - const domains = useAppSelector((state) => state.domain_lists.getIn(['blocks', 'items'])) as string[]; - const hasMore = useAppSelector((state) => !!state.domain_lists.getIn(['blocks', 'next'])); + const domains = useAppSelector((state) => state.domain_lists.blocks.items); + const hasMore = useAppSelector((state) => !!state.domain_lists.blocks.next); React.useEffect(() => { dispatch(fetchDomainBlocks()); diff --git a/app/soapbox/features/favourited_statuses/index.js b/app/soapbox/features/favourited_statuses/index.js index 73ad5a255..0de3d520d 100644 --- a/app/soapbox/features/favourited_statuses/index.js +++ b/app/soapbox/features/favourited_statuses/index.js @@ -32,9 +32,9 @@ const mapStateToProps = (state, { params }) => { if (isMyAccount) { return { isMyAccount, - statusIds: state.getIn(['status_lists', 'favourites', 'items']), - isLoading: state.getIn(['status_lists', 'favourites', 'isLoading'], true), - hasMore: !!state.getIn(['status_lists', 'favourites', 'next']), + statusIds: state.status_lists.get('favourites').items, + isLoading: state.status_lists.get('favourites').isLoading, + hasMore: !!state.status_lists.get('favourites').next, }; } @@ -57,9 +57,9 @@ const mapStateToProps = (state, { params }) => { unavailable, username, isAccount: !!state.getIn(['accounts', accountId]), - statusIds: state.getIn(['status_lists', `favourites:${accountId}`, 'items'], []), - isLoading: state.getIn(['status_lists', `favourites:${accountId}`, 'isLoading'], true), - hasMore: !!state.getIn(['status_lists', `favourites:${accountId}`, 'next']), + statusIds: state.status_lists.get(`favourites:${accountId}`)?.items || [], + isLoading: state.status_lists.get(`favourites:${accountId}`)?.isLoading, + hasMore: !!state.status_lists.get(`favourites:${accountId}`)?.next, }; }; @@ -147,7 +147,7 @@ class Favourites extends ImmutablePureComponent { statusIds={statusIds} scrollKey='favourited_statuses' hasMore={hasMore} - isLoading={isLoading} + isLoading={typeof isLoading === 'boolean' ? isLoading : true} onLoadMore={this.handleLoadMore} emptyMessage={emptyMessage} /> diff --git a/app/soapbox/features/follow_recommendations/components/follow_recommendations_list.tsx b/app/soapbox/features/follow_recommendations/components/follow_recommendations_list.tsx index 841f5e7d0..e9e295d58 100644 --- a/app/soapbox/features/follow_recommendations/components/follow_recommendations_list.tsx +++ b/app/soapbox/features/follow_recommendations/components/follow_recommendations_list.tsx @@ -11,8 +11,8 @@ import Account from './account'; const FollowRecommendationsList: React.FC = () => { const dispatch = useDispatch(); - const suggestions = useAppSelector((state) => state.suggestions.get('items')); - const isLoading = useAppSelector((state) => state.suggestions.get('isLoading')); + const suggestions = useAppSelector((state) => state.suggestions.items); + const isLoading = useAppSelector((state) => state.suggestions.isLoading); useEffect(() => { if (suggestions.size === 0) { @@ -30,8 +30,8 @@ const FollowRecommendationsList: React.FC = () => { return (
- {suggestions.size > 0 ? suggestions.map((suggestion: { account: string }, idx: number) => ( - + {suggestions.size > 0 ? suggestions.map((suggestion) => ( + )) : (
diff --git a/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx b/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx index 2ef5ab828..0b09ca4c1 100644 --- a/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx +++ b/app/soapbox/features/onboarding/steps/suggested-accounts-step.tsx @@ -1,4 +1,3 @@ -import { Map as ImmutableMap } from 'immutable'; import debounce from 'lodash/debounce'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; @@ -13,9 +12,9 @@ import { useAppSelector } from 'soapbox/hooks'; const SuggestedAccountsStep = ({ onNext }: { onNext: () => void }) => { const dispatch = useDispatch(); - const suggestions = useAppSelector((state) => state.suggestions.get('items')); - const hasMore = useAppSelector((state) => !!state.suggestions.get('next')); - const isLoading = useAppSelector((state) => state.suggestions.get('isLoading')); + const suggestions = useAppSelector((state) => state.suggestions.items); + const hasMore = useAppSelector((state) => !!state.suggestions.next); + const isLoading = useAppSelector((state) => state.suggestions.isLoading); const handleLoadMore = debounce(() => { if (isLoading) { @@ -40,11 +39,11 @@ const SuggestedAccountsStep = ({ onNext }: { onNext: () => void }) => { useWindowScroll={false} style={{ height: 320 }} > - {suggestions.map((suggestion: ImmutableMap) => ( -
+ {suggestions.map((suggestion) => ( +
, but it isn't - id={suggestion.get('account')} + id={suggestion.account} showProfileHoverCard={false} />
diff --git a/app/soapbox/features/pinned_statuses/index.js b/app/soapbox/features/pinned_statuses/index.js index b6649a01b..9901131ba 100644 --- a/app/soapbox/features/pinned_statuses/index.js +++ b/app/soapbox/features/pinned_statuses/index.js @@ -21,8 +21,8 @@ const mapStateToProps = (state, { params }) => { const meUsername = state.getIn(['accounts', me, 'username'], ''); return { isMyAccount: (username.toLowerCase() === meUsername.toLowerCase()), - statusIds: state.getIn(['status_lists', 'pins', 'items']), - hasMore: !!state.getIn(['status_lists', 'pins', 'next']), + statusIds: state.status_lists.get('pins').items, + hasMore: !!state.status_lists.get('pins').next, }; }; diff --git a/app/soapbox/features/scheduled_statuses/index.tsx b/app/soapbox/features/scheduled_statuses/index.tsx index 006e8894c..148c9c0a4 100644 --- a/app/soapbox/features/scheduled_statuses/index.tsx +++ b/app/soapbox/features/scheduled_statuses/index.tsx @@ -22,9 +22,9 @@ const ScheduledStatuses = () => { const intl = useIntl(); const dispatch = useAppDispatch(); - const statusIds = useAppSelector((state) => state.status_lists.getIn(['scheduled_statuses', 'items'])); - const isLoading = useAppSelector((state) => state.status_lists.getIn(['scheduled_statuses', 'isLoading'])); - const hasMore = useAppSelector((state) => !!state.status_lists.getIn(['scheduled_statuses', 'next'])); + const statusIds = useAppSelector((state) => state.status_lists.get('scheduled_statuses')!.items); + const isLoading = useAppSelector((state) => state.status_lists.get('scheduled_statuses')!.isLoading); + const hasMore = useAppSelector((state) => !!state.status_lists.get('scheduled_statuses')!.next); useEffect(() => { dispatch(fetchScheduledStatuses()); @@ -37,7 +37,7 @@ const ScheduledStatuses = () => { handleLoadMore(dispatch)} emptyMessage={emptyMessage} > diff --git a/app/soapbox/features/status/components/action-bar.tsx b/app/soapbox/features/status/components/action-bar.tsx index 35cbaf79e..9db8e3925 100644 --- a/app/soapbox/features/status/components/action-bar.tsx +++ b/app/soapbox/features/status/components/action-bar.tsx @@ -387,9 +387,9 @@ class ActionBar extends React.PureComponent { if (me) { if (features.bookmarks) { menu.push({ - text: intl.formatMessage(status.get('bookmarked') ? messages.unbookmark : messages.bookmark), + text: intl.formatMessage(status.bookmarked ? messages.unbookmark : messages.bookmark), action: this.handleBookmarkClick, - icon: require(status.get('bookmarked') ? '@tabler/icons/icons/bookmark-off.svg' : '@tabler/icons/icons/bookmark.svg'), + icon: require(status.bookmarked ? '@tabler/icons/icons/bookmark-off.svg' : '@tabler/icons/icons/bookmark.svg'), }); } @@ -406,7 +406,7 @@ class ActionBar extends React.PureComponent { menu.push(null); } else if (status.visibility === 'private') { menu.push({ - text: intl.formatMessage(status.get('reblogged') ? messages.cancel_reblog_private : messages.reblog_private), + text: intl.formatMessage(status.reblogged ? messages.cancel_reblog_private : messages.reblog_private), action: this.handleReblogClick, icon: require('@tabler/icons/icons/repeat.svg'), }); @@ -496,7 +496,7 @@ class ActionBar extends React.PureComponent { } menu.push({ - text: intl.formatMessage(status.get('sensitive') === false ? messages.markStatusSensitive : messages.markStatusNotSensitive), + text: intl.formatMessage(status.sensitive === false ? messages.markStatusSensitive : messages.markStatusNotSensitive), action: this.handleToggleStatusSensitivity, icon: require('@tabler/icons/icons/alert-triangle.svg'), }); @@ -523,18 +523,18 @@ class ActionBar extends React.PureComponent { } } - const canShare = ('share' in navigator) && status.get('visibility') === 'public'; + const canShare = ('share' in navigator) && status.visibility === 'public'; let reblogIcon = require('@tabler/icons/icons/repeat.svg'); - if (status.get('visibility') === 'direct') { + if (status.visibility === 'direct') { reblogIcon = require('@tabler/icons/icons/mail.svg'); - } else if (status.get('visibility') === 'private') { + } else if (status.visibility === 'private') { reblogIcon = require('@tabler/icons/icons/lock.svg'); } - const reblog_disabled = (status.get('visibility') === 'direct' || status.get('visibility') === 'private'); + const reblog_disabled = (status.visibility === 'direct' || status.visibility === 'private'); const reblogMenu: Menu = [{ text: intl.formatMessage(status.reblogged ? messages.cancel_reblog_private : messages.reblog), diff --git a/app/soapbox/features/status/components/status-interaction-bar.tsx b/app/soapbox/features/status/components/status-interaction-bar.tsx index 13ecf6c60..6f121780b 100644 --- a/app/soapbox/features/status/components/status-interaction-bar.tsx +++ b/app/soapbox/features/status/components/status-interaction-bar.tsx @@ -53,7 +53,7 @@ const StatusInteractionBar: React.FC = ({ status }): JSX. const getNormalizedReacts = () => { return reduceEmoji( - ImmutableList(status.getIn(['pleroma', 'emoji_reactions']) as any), + ImmutableList(status.pleroma.get('emoji_reactions') as any), status.favourites_count, status.favourited, allowedEmoji, diff --git a/app/soapbox/features/status/index.tsx b/app/soapbox/features/status/index.tsx index 8af71c530..39d768e9f 100644 --- a/app/soapbox/features/status/index.tsx +++ b/app/soapbox/features/status/index.tsx @@ -332,7 +332,7 @@ class Status extends ImmutablePureComponent { handleEditClick = (status: StatusEntity) => { const { dispatch } = this.props; - dispatch(editStatus(status.get('id'))); + dispatch(editStatus(status.id)); } handleDirectClick = (account: AccountEntity, router: History) => { diff --git a/app/soapbox/features/ui/components/__tests__/who-to-follow-panel.test.tsx b/app/soapbox/features/ui/components/__tests__/who-to-follow-panel.test.tsx index 92123eb24..56e4f8422 100644 --- a/app/soapbox/features/ui/components/__tests__/who-to-follow-panel.test.tsx +++ b/app/soapbox/features/ui/components/__tests__/who-to-follow-panel.test.tsx @@ -1,4 +1,4 @@ -import { Map as ImmutableMap, fromJS } from 'immutable'; +import { Map as ImmutableMap, OrderedSet as ImmutableOrderedSet } from 'immutable'; import React from 'react'; import { render, screen } from '../../../../jest/test-helpers'; @@ -16,12 +16,12 @@ describe('', () => { avatar: 'test.jpg', }), }), - suggestions: ImmutableMap({ - items: fromJS([{ + suggestions: { + items: ImmutableOrderedSet([{ source: 'staff', account: '1', }]), - }), + }, }; render(, null, store); @@ -44,8 +44,8 @@ describe('', () => { avatar: 'test.jpg', }), }), - suggestions: ImmutableMap({ - items: fromJS([ + suggestions: { + items: ImmutableOrderedSet([ { source: 'staff', account: '1', @@ -55,7 +55,7 @@ describe('', () => { account: '2', }, ]), - }), + }, }; render(, null, store); @@ -78,8 +78,8 @@ describe('', () => { avatar: 'test.jpg', }), }), - suggestions: ImmutableMap({ - items: fromJS([ + suggestions: { + items: ImmutableOrderedSet([ { source: 'staff', account: '1', @@ -89,7 +89,7 @@ describe('', () => { account: '2', }, ]), - }), + }, }; render(, null, store); @@ -112,9 +112,9 @@ describe('', () => { avatar: 'test.jpg', }), }), - suggestions: ImmutableMap({ - items: fromJS([]), - }), + suggestions: { + items: ImmutableOrderedSet([]), + }, }; render(, null, store); diff --git a/app/soapbox/features/ui/components/action-button.tsx b/app/soapbox/features/ui/components/action-button.tsx index 205aed90f..18479111d 100644 --- a/app/soapbox/features/ui/components/action-button.tsx +++ b/app/soapbox/features/ui/components/action-button.tsx @@ -52,7 +52,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = const me = useAppSelector((state) => state.me); const handleFollow = () => { - if (account.getIn(['relationship', 'following']) || account.getIn(['relationship', 'requested'])) { + if (account.relationship?.following || account.relationship?.requested) { dispatch(unfollowAccount(account.id)); } else { dispatch(followAccount(account.id)); @@ -60,7 +60,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = }; const handleBlock = () => { - if (account.getIn(['relationship', 'blocking'])) { + if (account.relationship?.blocking) { dispatch(unblockAccount(account.id)); } else { dispatch(blockAccount(account.id)); @@ -68,7 +68,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = }; const handleMute = () => { - if (account.getIn(['relationship', 'muting'])) { + if (account.relationship?.muting) { dispatch(unmuteAccount(account.id)); } else { dispatch(muteAccount(account.id)); @@ -85,7 +85,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = /** Handles actionType='muting' */ const mutingAction = () => { - const isMuted = account.getIn(['relationship', 'muting']); + const isMuted = account.relationship?.muting; const messageKey = isMuted ? messages.unmute : messages.mute; const text = intl.formatMessage(messageKey, { name: account.username }); @@ -101,7 +101,7 @@ const ActionButton: React.FC = ({ account, actionType, small }) = /** Handles actionType='blocking' */ const blockingAction = () => { - const isBlocked = account.getIn(['relationship', 'blocking']); + const isBlocked = account.relationship?.blocking; const messageKey = isBlocked ? messages.unblock : messages.block; const text = intl.formatMessage(messageKey, { name: account.username }); @@ -154,8 +154,8 @@ const ActionButton: React.FC = ({ account, actionType, small }) = } if (me !== account.id) { - const isFollowing = account.getIn(['relationship', 'following']); - const blockedBy = account.getIn(['relationship', 'blocked_by']) as boolean; + const isFollowing = account.relationship?.following; + const blockedBy = account.relationship?.blocked_by as boolean; if (actionType) { if (actionType === 'muting') { @@ -165,10 +165,10 @@ const ActionButton: React.FC = ({ account, actionType, small }) = } } - if (account.relationship.isEmpty()) { + if (!account.relationship) { // Wait until the relationship is loaded return null; - } else if (account.getIn(['relationship', 'requested'])) { + } else if (account.relationship?.requested) { // Awaiting acceptance return ( ); - } else if (account.getIn(['relationship', 'blocking'])) { + } else if (account.relationship?.blocking) { // Unblock return (