do not include group in selected status
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
9f709793a4
commit
6d56513b9a
4 changed files with 11 additions and 12 deletions
|
@ -2,6 +2,7 @@ import React, { useRef } from 'react';
|
|||
import { FormattedDate, FormattedMessage, useIntl } from 'react-intl';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useGroup } from 'pl-fe/api/hooks';
|
||||
import Account from 'pl-fe/components/account';
|
||||
import StatusContent from 'pl-fe/components/status-content';
|
||||
import StatusLanguagePicker from 'pl-fe/components/status-language-picker';
|
||||
|
@ -34,12 +35,14 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
|
|||
|
||||
const node = useRef<HTMLDivElement>(null);
|
||||
|
||||
const groupQuery = useGroup(status.group_id || undefined);
|
||||
|
||||
const handleOpenCompareHistoryModal = () => {
|
||||
onOpenCompareHistoryModal(status);
|
||||
};
|
||||
|
||||
const renderStatusInfo = () => {
|
||||
if (status.group) {
|
||||
if (groupQuery.group) {
|
||||
return (
|
||||
<div className='mb-4'>
|
||||
<StatusInfo
|
||||
|
@ -56,10 +59,10 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
|
|||
defaultMessage='Posted in {group}'
|
||||
values={{
|
||||
group: (
|
||||
<Link to={`/groups/${status.group.id}`} className='hover:underline'>
|
||||
<Link to={`/groups/${status.group_id}`} className='hover:underline'>
|
||||
<bdi className='truncate'>
|
||||
<strong className='text-gray-800 dark:text-gray-200'>
|
||||
<span dangerouslySetInnerHTML={{ __html: status.group.display_name_html }} />
|
||||
<span dangerouslySetInnerHTML={{ __html: groupQuery.group?.display_name_html }} />
|
||||
</strong>
|
||||
</bdi>
|
||||
</Link>
|
||||
|
|
|
@ -88,9 +88,9 @@ const StatusDetails: React.FC<IStatusDetails> = (props) => {
|
|||
);
|
||||
}
|
||||
|
||||
if (status.group && typeof status.group === 'object') {
|
||||
if (status.group.id && !props.params.groupId) {
|
||||
return <Redirect to={`/groups/${status.group.id}/posts/${props.params.statusId}`} />;
|
||||
if (status.group_id) {
|
||||
if (status.group_id && !props.params.groupId) {
|
||||
return <Redirect to={`/groups/${status.group_id}/posts/${props.params.statusId}`} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ const PendingStatusMedia: React.FC<IPendingStatusMedia> = ({ status }) => {
|
|||
media={status.media_attachments}
|
||||
/>
|
||||
);
|
||||
} else if (!status.quote && shouldHaveCard(status)) {
|
||||
} else if (!status.quote_id && shouldHaveCard(status)) {
|
||||
return <PlaceholderCard />;
|
||||
} else {
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useIntl } from 'react-intl';
|
||||
|
||||
import { useAccount, useGroup } from 'pl-fe/api/hooks';
|
||||
import { useAccount } from 'pl-fe/api/hooks';
|
||||
import { useAppSelector, useClient } from 'pl-fe/hooks';
|
||||
import { importEntities } from 'pl-fe/pl-hooks/importer';
|
||||
import { queryClient } from 'pl-fe/queries/client';
|
||||
|
@ -109,12 +109,10 @@ const useStatus = (statusId?: string) => {
|
|||
const status = statusQuery.data;
|
||||
|
||||
const { account } = useAccount(status?.account_id || undefined);
|
||||
const { group } = useGroup(status?.group_id || undefined);
|
||||
|
||||
// : (Status & {
|
||||
// account: Account;
|
||||
// accounts: Array<Account>;
|
||||
// group: Group | null;
|
||||
// reblog: Status | null;
|
||||
// }) | null
|
||||
const data = useAppSelector((state) => {
|
||||
|
@ -125,11 +123,9 @@ const useStatus = (statusId?: string) => {
|
|||
...status,
|
||||
account: account!,
|
||||
accounts,
|
||||
group,
|
||||
// quote,
|
||||
// reblog,
|
||||
// poll
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue