pl-fe: Accept posts without accounts (terrible workaround)
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -10,23 +10,6 @@ const STATUS_IMPORT = 'STATUS_IMPORT' as const;
|
||||
const STATUSES_IMPORT = 'STATUSES_IMPORT' as const;
|
||||
const POLLS_IMPORT = 'POLLS_IMPORT' as const;
|
||||
|
||||
// Sometimes Pleroma can return an empty account,
|
||||
// or a repost can appear of a deleted account. Skip these statuses.
|
||||
const isBroken = (status: BaseStatus) => {
|
||||
try {
|
||||
if (status.scheduled_at !== null) return true;
|
||||
// Skip empty accounts
|
||||
// https://gitlab.com/soapbox-pub/soapbox/-/issues/424
|
||||
if (!status.account.id) return true;
|
||||
// Skip broken reposts
|
||||
// https://gitlab.com/soapbox-pub/rebased/-/issues/28
|
||||
if (status.reblog && !status.reblog.account.id) return true;
|
||||
return false;
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
const isEmpty = (object: Record<string, any>) => !Object.values(object).some(value => value);
|
||||
|
||||
interface ImportStatusAction {
|
||||
@ -80,7 +63,7 @@ const importEntities = (entities: {
|
||||
|
||||
const processStatus = (status: BaseStatus, withSelf = true) => {
|
||||
// Skip broken statuses
|
||||
if (isBroken(status)) return;
|
||||
if (status.scheduled_at !== null) return;
|
||||
|
||||
if (withSelf) statuses[status.id] = status;
|
||||
|
||||
|
||||
@ -83,14 +83,16 @@ const QuotedStatus: React.FC<IQuotedStatus> = ({ status, onCancel, compose }) =>
|
||||
space={2}
|
||||
onClick={handleExpandClick}
|
||||
>
|
||||
<AccountContainer
|
||||
{...actions}
|
||||
id={account.id}
|
||||
timestamp={status.created_at}
|
||||
withRelationship={false}
|
||||
showAccountHoverCard={!compose}
|
||||
withLinkToProfile={!compose}
|
||||
/>
|
||||
{account.id && (
|
||||
<AccountContainer
|
||||
{...actions}
|
||||
id={account.id}
|
||||
timestamp={status.created_at}
|
||||
withRelationship={false}
|
||||
showAccountHoverCard={!compose}
|
||||
withLinkToProfile={!compose}
|
||||
/>
|
||||
)}
|
||||
|
||||
<StatusReplyMentions status={status} hoverable={false} />
|
||||
|
||||
|
||||
@ -382,33 +382,35 @@ const Status: React.FC<IStatus> = (props) => {
|
||||
>
|
||||
{statusInfo}
|
||||
|
||||
<div className='flex'>
|
||||
<AccountContainer
|
||||
key={actualStatus.account_id}
|
||||
id={actualStatus.account_id}
|
||||
action={
|
||||
<div className='flex flex-row-reverse items-center gap-1 self-baseline'>
|
||||
<Link to={statusUrl} className='hover:underline' onClick={(event) => event.stopPropagation()}>
|
||||
<RelativeTimestamp timestamp={actualStatus.created_at} theme='muted' size='sm' className='whitespace-nowrap' />
|
||||
</Link>
|
||||
<StatusTypeIcon visibility={actualStatus.visibility} />
|
||||
<StatusLanguagePicker status={actualStatus} />
|
||||
{!!actualStatus.edited_at && (
|
||||
<>
|
||||
<span className='⁂-separator' />
|
||||
{actualStatus.account_id && (
|
||||
<div className='flex'>
|
||||
<AccountContainer
|
||||
key={actualStatus.account_id}
|
||||
id={actualStatus.account_id}
|
||||
action={
|
||||
<div className='flex flex-row-reverse items-center gap-1 self-baseline'>
|
||||
<Link to={statusUrl} className='hover:underline' onClick={(event) => event.stopPropagation()}>
|
||||
<RelativeTimestamp timestamp={actualStatus.created_at} theme='muted' size='sm' className='whitespace-nowrap' />
|
||||
</Link>
|
||||
<StatusTypeIcon visibility={actualStatus.visibility} />
|
||||
<StatusLanguagePicker status={actualStatus} />
|
||||
{!!actualStatus.edited_at && (
|
||||
<>
|
||||
<span className='⁂-separator' />
|
||||
|
||||
<Icon className='size-4 text-gray-700 dark:text-gray-600' src={require('@phosphor-icons/core/regular/pencil-simple.svg')} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
showAccountHoverCard={hoverable}
|
||||
withLinkToProfile={hoverable}
|
||||
approvalStatus={actualStatus.approval_status}
|
||||
avatarSize={avatarSize}
|
||||
actionAlignment='top'
|
||||
/>
|
||||
</div>
|
||||
<Icon className='size-4 text-gray-700 dark:text-gray-600' src={require('@phosphor-icons/core/regular/pencil-simple.svg')} />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
showAccountHoverCard={hoverable}
|
||||
withLinkToProfile={hoverable}
|
||||
approvalStatus={actualStatus.approval_status}
|
||||
avatarSize={avatarSize}
|
||||
actionAlignment='top'
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className='status__content-wrapper'>
|
||||
<StatusReplyMentions status={actualStatus} hoverable={hoverable} />
|
||||
|
||||
@ -88,15 +88,17 @@ const DetailedStatus: React.FC<IDetailedStatus> = ({
|
||||
<div ref={node} className='detailed-actualStatus' tabIndex={-1}>
|
||||
{renderStatusInfo()}
|
||||
|
||||
<div className='mb-4'>
|
||||
<Account
|
||||
key={account.id}
|
||||
account={account}
|
||||
avatarSize={42}
|
||||
hideActions
|
||||
approvalStatus={actualStatus.approval_status}
|
||||
/>
|
||||
</div>
|
||||
{account.id && (
|
||||
<div className='mb-4'>
|
||||
<Account
|
||||
key={account.id}
|
||||
account={account}
|
||||
avatarSize={42}
|
||||
hideActions
|
||||
approvalStatus={actualStatus.approval_status}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<StatusReplyMentions status={actualStatus} />
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
/// <reference path="../node_modules/@types/dom-chromium-ai/index.d.ts" />
|
||||
(window as any).__PL_API_FALLBACK_ACCOUNT = { id: '', acct: 'undefined', url: location.host };
|
||||
|
||||
import './polyfills';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user