From e781fed6ece28b6c8fc607a43ffcbe575bb9f501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Fri, 27 Feb 2026 16:46:58 +0100 Subject: [PATCH] nicolium: ? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/nicolium/src/reducers/statuses.ts | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/nicolium/src/reducers/statuses.ts b/packages/nicolium/src/reducers/statuses.ts index d4f7996fd..2fbbb4a42 100644 --- a/packages/nicolium/src/reducers/statuses.ts +++ b/packages/nicolium/src/reducers/statuses.ts @@ -4,6 +4,7 @@ import { type Status as BaseStatus, type CreateStatusParams, type MediaAttachment, + type StatusWithoutAccount, mentionSchema, } from 'pl-api'; import * as v from 'valibot'; @@ -108,9 +109,11 @@ const normalizeStatus = ( poll, group, ...status - }: BaseStatus & { - accounts?: Array; - }, + }: + | BaseStatus + | (StatusWithoutAccount & { + accounts?: Array; + }), oldStatus?: OldStatus, ) => { const searchIndex = getSearchIndex(status, oldStatus, poll); @@ -124,9 +127,11 @@ const normalizeStatus = ( } }); + const accountId = (account || (window as any).__PL_API_FALLBACK_ACCOUNT)?.id; + // Add self to mentions if it's a reply to self - const isSelfReply = account.id === status.in_reply_to_account_id; - const hasSelfMention = status.mentions.some((mention) => account.id === mention.id); + const isSelfReply = accountId === status.in_reply_to_account_id; + const hasSelfMention = status.mentions.some((mention) => accountId === mention.id); if (isSelfReply && !hasSelfMention) { const selfMention = v.parse(mentionSchema, account); @@ -163,7 +168,7 @@ const normalizeStatus = ( } return { - account_id: account.id, + account_id: accountId, reblog_id: reblog?.id ?? null, poll_id: poll?.id ?? null, group_id: group?.id ?? null, @@ -183,13 +188,13 @@ type NormalizedStatus = ReturnType; type State = Record; -const importStatus = (state: State, status: BaseStatus) => { +const importStatus = (state: State, status: BaseStatus | StatusWithoutAccount) => { const oldStatus = state[status.id]; state[status.id] = normalizeStatus(status, oldStatus); }; -const importStatuses = (state: State, statuses: Array) => { +const importStatuses = (state: State, statuses: Array) => { statuses.forEach((status) => { importStatus(state, status); });