pl-fe: Prefer using ids directly

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2024-10-05 23:49:21 +02:00
parent 7c69260004
commit 3e94d9dd53
7 changed files with 12 additions and 12 deletions

View file

@ -372,7 +372,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
message: intl.formatMessage(messages.groupBlockFromGroupMessage, { name: status.account.username }), message: intl.formatMessage(messages.groupBlockFromGroupMessage, { name: status.account.username }),
confirm: intl.formatMessage(messages.groupBlockConfirm), confirm: intl.formatMessage(messages.groupBlockConfirm),
onConfirm: () => { onConfirm: () => {
blockGroupMember([status.account.id], { blockGroupMember([status.account_id], {
onSuccess() { onSuccess() {
toast.success(intl.formatMessage(messages.blocked, { name: account?.acct })); toast.success(intl.formatMessage(messages.blocked, { name: account?.acct }));
}, },
@ -395,7 +395,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
const _makeMenu = (publicStatus: boolean) => { const _makeMenu = (publicStatus: boolean) => {
const mutingConversation = status.muted; const mutingConversation = status.muted;
const ownAccount = status.account.id === me; const ownAccount = status.account_id === me;
const username = status.account.username; const username = status.account.username;
const account = status.account; const account = status.account;

View file

@ -396,8 +396,8 @@ const Status: React.FC<IStatus> = (props) => {
{renderStatusInfo()} {renderStatusInfo()}
<AccountContainer <AccountContainer
key={actualStatus.account.id} key={actualStatus.account_id}
id={actualStatus.account.id} id={actualStatus.account_id}
timestamp={actualStatus.created_at} timestamp={actualStatus.created_at}
timestampUrl={statusUrl} timestampUrl={statusUrl}
action={accountAction} action={accountAction}

View file

@ -8,11 +8,11 @@ import { Stack } from 'pl-fe/components/ui';
import AccountContainer from 'pl-fe/containers/account-container'; import AccountContainer from 'pl-fe/containers/account-container';
import { getTextDirection } from 'pl-fe/utils/rtl'; import { getTextDirection } from 'pl-fe/utils/rtl';
import type { Account, Status } from 'pl-fe/normalizers'; import type { Status } from 'pl-fe/normalizers';
interface IReplyIndicator { interface IReplyIndicator {
className?: string; className?: string;
status?: Pick<Status, | 'contentHtml' | 'created_at' | 'hidden' | 'media_attachments' | 'mentions' | 'search_index' | 'sensitive' | 'spoiler_text' | 'quote_id'> & { account: Pick<Account, 'id'> }; status?: Pick<Status, 'account_id' | 'contentHtml' | 'created_at' | 'hidden' | 'media_attachments' | 'mentions' | 'search_index' | 'sensitive' | 'spoiler_text' | 'quote_id'>;
onCancel?: () => void; onCancel?: () => void;
hideActions: boolean; hideActions: boolean;
} }
@ -40,7 +40,7 @@ const ReplyIndicator: React.FC<IReplyIndicator> = ({ className, status, hideActi
<Stack space={2} className={clsx('max-h-72 overflow-y-auto rounded-lg bg-gray-100 p-4 black:bg-gray-900 dark:bg-gray-800', className)}> <Stack space={2} className={clsx('max-h-72 overflow-y-auto rounded-lg bg-gray-100 p-4 black:bg-gray-900 dark:bg-gray-800', className)}>
<AccountContainer <AccountContainer
{...actions} {...actions}
id={status.account.id} id={status.account_id}
timestamp={status.created_at} timestamp={status.created_at}
showAccountHoverCard={false} showAccountHoverCard={false}
withLinkToProfile={false} withLinkToProfile={false}

View file

@ -339,7 +339,7 @@ const Notification: React.FC<INotification> = (props) => {
case 'move': case 'move':
return account && typeof account === 'object' && notification.target && typeof notification.target === 'object' ? ( return account && typeof account === 'object' && notification.target && typeof notification.target === 'object' ? (
<AccountContainer <AccountContainer
id={notification.target.id} id={notification.target_id}
hidden={hidden} hidden={hidden}
avatarSize={avatarSize} avatarSize={avatarSize}
withRelationship withRelationship

View file

@ -21,7 +21,7 @@ const ReplyMentionsModal: React.FC<BaseModalProps & ReplyMentionsModalProps> = (
const { account } = useOwnAccount(); const { account } = useOwnAccount();
const mentions = statusToMentionsAccountIdsArray(status!, account!, compose.parent_reblogged_by); const mentions = statusToMentionsAccountIdsArray(status!, account!, compose.parent_reblogged_by);
const author = status?.account.id; const author = status?.account_id;
const onClickClose = () => { const onClickClose = () => {
onClose('REPLY_MENTIONS'); onClose('REPLY_MENTIONS');

View file

@ -197,10 +197,10 @@ const buildReferencesTo = (
// statuses.getIn([statusId, 'account']) === relationship.id, // statuses.getIn([statusId, 'account']) === relationship.id,
// )); // ));
const filterTimelines = (state: State, relationship: Relationship, statuses: ImmutableMap<string, Pick<Status, 'id' | 'account' | 'reblog_id'>>) => const filterTimelines = (state: State, relationship: Relationship, statuses: ImmutableMap<string, Pick<Status, 'id' | 'account' | 'account_id' | 'reblog_id'>>) =>
state.withMutations(state => { state.withMutations(state => {
statuses.forEach(status => { statuses.forEach(status => {
if (status.account.id !== relationship.id) return; if (status.account_id !== relationship.id) return;
const references = buildReferencesTo(statuses, status); const references = buildReferencesTo(statuses, status);
deleteStatus(state, status.id, references, relationship.id); deleteStatus(state, status.id, references, relationship.id);
}); });

View file

@ -183,7 +183,7 @@ const makeGetNotification = () => createSelector([
// @ts-ignore // @ts-ignore
(state: RootState, notification: MinifiedNotification) => state.statuses.get(notification.status_id), (state: RootState, notification: MinifiedNotification) => state.statuses.get(notification.status_id),
(state: RootState, notification: MinifiedNotification) => notification.account_ids ? selectAccounts(state, notification.account_ids) : null, (state: RootState, notification: MinifiedNotification) => notification.account_ids ? selectAccounts(state, notification.account_ids) : null,
], (notification, account, target, status, accounts): Notification => ({ ], (notification, account, target, status, accounts): MinifiedNotification & Notification => ({
...notification, ...notification,
// @ts-ignore // @ts-ignore
account: account || null, account: account || null,