kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Remove getIn calls in status and status-action-bar components
rodzic
98cfb6fae5
commit
e07412f872
|
@ -282,7 +282,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOpen: React.EventHandler<React.MouseEvent> = (e) => {
|
const handleOpen: React.EventHandler<React.MouseEvent> = (e) => {
|
||||||
history.push(`/@${status.getIn(['account', 'acct'])}/posts/${status.id}`);
|
history.push(`/@${status.account.acct}/posts/${status.id}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleEmbed = () => {
|
const handleEmbed = () => {
|
||||||
|
@ -338,9 +338,9 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||||
|
|
||||||
const _makeMenu = (publicStatus: boolean) => {
|
const _makeMenu = (publicStatus: boolean) => {
|
||||||
const mutingConversation = status.muted;
|
const mutingConversation = status.muted;
|
||||||
const ownAccount = status.getIn(['account', 'id']) === me;
|
const ownAccount = status.account.id === me;
|
||||||
const username = String(status.getIn(['account', 'username']));
|
const username = status.account.username;
|
||||||
const account = status.account as Account;
|
const account = status.account;
|
||||||
const domain = account.fqn.split('@')[1];
|
const domain = account.fqn.split('@')[1];
|
||||||
|
|
||||||
const menu: Menu = [];
|
const menu: Menu = [];
|
||||||
|
@ -456,7 +456,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
|
||||||
icon: require('@tabler/icons/at.svg'),
|
icon: require('@tabler/icons/at.svg'),
|
||||||
});
|
});
|
||||||
|
|
||||||
if (status.getIn(['account', 'pleroma', 'accepts_chat_messages']) === true) {
|
if (status.account.pleroma?.accepts_chat_messages === true) {
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.chat, { name: username }),
|
text: intl.formatMessage(messages.chat, { name: username }),
|
||||||
action: handleChatClick,
|
action: handleChatClick,
|
||||||
|
|
|
@ -26,7 +26,6 @@ import { Card, Icon, Stack, Text } from './ui';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
Account as AccountEntity,
|
Account as AccountEntity,
|
||||||
Group as GroupEntity,
|
|
||||||
Status as StatusEntity,
|
Status as StatusEntity,
|
||||||
} from 'soapbox/types/entities';
|
} from 'soapbox/types/entities';
|
||||||
|
|
||||||
|
@ -90,8 +89,8 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
|
|
||||||
const actualStatus = getActualStatus(status);
|
const actualStatus = getActualStatus(status);
|
||||||
const isReblog = status.reblog && typeof status.reblog === 'object';
|
const isReblog = status.reblog && typeof status.reblog === 'object';
|
||||||
const statusUrl = `/@${actualStatus.getIn(['account', 'acct'])}/posts/${actualStatus.id}`;
|
const statusUrl = `/@${actualStatus.account.acct}/posts/${actualStatus.id}`;
|
||||||
const group = actualStatus.group as GroupEntity | null;
|
const group = actualStatus.group;
|
||||||
|
|
||||||
const filtered = (status.filtered.size || actualStatus.filtered.size) > 0;
|
const filtered = (status.filtered.size || actualStatus.filtered.size) > 0;
|
||||||
|
|
||||||
|
@ -177,7 +176,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyOpenProfile = (): void => {
|
const handleHotkeyOpenProfile = (): void => {
|
||||||
history.push(`/@${actualStatus.getIn(['account', 'acct'])}`);
|
history.push(`/@${actualStatus.account.acct}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleHotkeyMoveUp = (e?: KeyboardEvent): void => {
|
const handleHotkeyMoveUp = (e?: KeyboardEvent): void => {
|
||||||
|
@ -224,25 +223,25 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
values={{
|
values={{
|
||||||
name: (
|
name: (
|
||||||
<Link
|
<Link
|
||||||
to={`/@${status.getIn(['account', 'acct'])}`}
|
to={`/@${status.account.acct}`}
|
||||||
className='hover:underline'
|
className='hover:underline'
|
||||||
>
|
>
|
||||||
<bdi className='truncate'>
|
<bdi className='truncate'>
|
||||||
<strong
|
<strong
|
||||||
className='text-gray-800 dark:text-gray-200'
|
className='text-gray-800 dark:text-gray-200'
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: String(status.getIn(['account', 'display_name_html'])),
|
__html: status.account.display_name_html,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</bdi>
|
</bdi>
|
||||||
</Link>
|
</Link>
|
||||||
),
|
),
|
||||||
group: (
|
group: (
|
||||||
<Link to={`/group/${(status.group as GroupEntity).slug}`} className='hover:underline'>
|
<Link to={`/group/${group.slug}`} className='hover:underline'>
|
||||||
<strong
|
<strong
|
||||||
className='text-gray-800 dark:text-gray-200'
|
className='text-gray-800 dark:text-gray-200'
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: (status.group as GroupEntity).display_name_html,
|
__html: group.display_name_html,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -263,12 +262,12 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
defaultMessage='{name} reposted'
|
defaultMessage='{name} reposted'
|
||||||
values={{
|
values={{
|
||||||
name: (
|
name: (
|
||||||
<Link to={`/@${status.getIn(['account', 'acct'])}`} className='hover:underline'>
|
<Link to={`/@${status.account.acct}`} className='hover:underline'>
|
||||||
<bdi className='truncate'>
|
<bdi className='truncate'>
|
||||||
<strong
|
<strong
|
||||||
className='text-gray-800 dark:text-gray-200'
|
className='text-gray-800 dark:text-gray-200'
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html: String(status.getIn(['account', 'display_name_html'])),
|
__html: status.account.display_name_html,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</bdi>
|
</bdi>
|
||||||
|
@ -322,7 +321,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
return (
|
return (
|
||||||
<div ref={node}>
|
<div ref={node}>
|
||||||
<>
|
<>
|
||||||
{actualStatus.getIn(['account', 'display_name']) || actualStatus.getIn(['account', 'username'])}
|
{actualStatus.account.display_name || actualStatus.account.username}
|
||||||
{actualStatus.content}
|
{actualStatus.content}
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
@ -354,7 +353,7 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
if (status.reblog && typeof status.reblog === 'object') {
|
if (status.reblog && typeof status.reblog === 'object') {
|
||||||
rebloggedByText = intl.formatMessage(
|
rebloggedByText = intl.formatMessage(
|
||||||
messages.reblogged_by,
|
messages.reblogged_by,
|
||||||
{ name: String(status.getIn(['account', 'acct'])) },
|
{ name: status.account.acct },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,8 +424,8 @@ const Status: React.FC<IStatus> = (props) => {
|
||||||
{renderStatusInfo()}
|
{renderStatusInfo()}
|
||||||
|
|
||||||
<AccountContainer
|
<AccountContainer
|
||||||
key={String(actualStatus.getIn(['account', 'id']))}
|
key={actualStatus.account.id}
|
||||||
id={String(actualStatus.getIn(['account', 'id']))}
|
id={actualStatus.account.id}
|
||||||
timestamp={actualStatus.created_at}
|
timestamp={actualStatus.created_at}
|
||||||
timestampUrl={statusUrl}
|
timestampUrl={statusUrl}
|
||||||
action={accountAction}
|
action={accountAction}
|
||||||
|
|
Ładowanie…
Reference in New Issue