diff --git a/packages/nicolium/src/locales/en.json b/packages/nicolium/src/locales/en.json index 7b6282771..f19457ab0 100644 --- a/packages/nicolium/src/locales/en.json +++ b/packages/nicolium/src/locales/en.json @@ -565,7 +565,6 @@ "column.search": "Search", "column.settings_store": "Settings store", "column.subscribers": "Subscribers", - "column.test": "Test timeline", "column.tokens": "Active sessions", "column.wrenched": "Recent wrenches timeline", "column_forbidden.body": "You do not have permission to access this page.", @@ -804,7 +803,6 @@ "developers.navigation.service_worker_label": "Service Worker", "developers.navigation.settings_store_label": "Settings store", "developers.navigation.show_toast": "Trigger Toast", - "developers.navigation.test_timeline_label": "Test timeline", "developers.settings_store.advanced": "Advanced settings", "developers.settings_store.hint": "It is possible to directly edit your user settings here. BE CAREFUL! Editing this section can break your account, and you will only be able to recover through the API.", "direct.search_placeholder": "Send a message to…", @@ -1016,7 +1014,6 @@ "empty_column.scheduled_statuses": "You don't have any scheduled statuses yet. When you add one, it will show up here.", "empty_column.search.accounts": "There are no people results for \"{term}\"", "empty_column.search.statuses": "There are no posts results for \"{term}\"", - "empty_column.test": "The test timeline is empty.", "empty_column.wrenched": "There is nothing here! 🔧 a public post to fill it up", "event.banner": "Event banner", "event.copy": "Copy link to event", diff --git a/packages/nicolium/src/modals/report-modal/steps/other-actions-step.tsx b/packages/nicolium/src/modals/report-modal/steps/other-actions-step.tsx index 487306207..a8ae3b6b7 100644 --- a/packages/nicolium/src/modals/report-modal/steps/other-actions-step.tsx +++ b/packages/nicolium/src/modals/report-modal/steps/other-actions-step.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useMemo, useState } from 'react'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import Button from '@/components/ui/button'; @@ -7,9 +7,9 @@ import HStack from '@/components/ui/hstack'; import Stack from '@/components/ui/stack'; import Text from '@/components/ui/text'; import Toggle from '@/components/ui/toggle'; -import { useAppSelector } from '@/hooks/use-app-selector'; import { useFeatures } from '@/hooks/use-features'; import StatusCheckBox from '@/modals/report-modal/components/status-check-box'; +import { useAccountTimeline } from '@/queries/timelines/use-timelines'; import { getDomain } from '@/utils/accounts'; import type { Account } from 'pl-api'; @@ -58,12 +58,21 @@ const OtherActionsStep = ({ const features = useFeatures(); const intl = useIntl(); - const statusIds = useAppSelector((state) => [ - ...new Set([ - ...state.timelines[`account:${account.id}:with_replies`].items, - ...selectedStatusIds, - ]), - ]); + const { entries } = useAccountTimeline(account.id, { exclude_replies: false }); + + const statusIds = useMemo(() => { + const timelineStatusIds = entries + .map((entry) => + entry.type === 'status' + ? entry.reblogIds.length > 0 + ? entry.reblogIds[0] + : entry.id + : null, + ) + .filter((id): id is string => id !== null); + + return [...new Set([...timelineStatusIds, ...selectedStatusIds])]; + }, [entries, selectedStatusIds]); const isBlocked = block; const isForward = forward; const canForward = !account.local && features.federating; diff --git a/packages/nicolium/src/stores/timelines.ts b/packages/nicolium/src/stores/timelines.ts index e887f366e..d23070cc9 100644 --- a/packages/nicolium/src/stores/timelines.ts +++ b/packages/nicolium/src/stores/timelines.ts @@ -11,6 +11,7 @@ type TimelineEntry = type: 'status'; id: string; rebloggedBy: Array; + reblogIds: Array; isConnectedTop?: boolean; isConnectedBottom?: boolean; } @@ -86,12 +87,14 @@ const processPage = (statuses: Array): Array => { // entry connection stuff might happen to call processStatus on the same status multiple times if (!existingEntry.rebloggedBy.includes(status.account.id)) { existingEntry.rebloggedBy.push(status.account.id); + existingEntry.reblogIds.push(status.id); } } else { timelinePage.push({ type: 'status', id: status.reblog.id, rebloggedBy: [status.account.id], + reblogIds: [status.id], isConnectedTop, }); } @@ -102,6 +105,7 @@ const processPage = (statuses: Array): Array => { type: 'status', id: status.id, rebloggedBy: [], + reblogIds: [], isConnectedTop, }); @@ -230,6 +234,7 @@ const useTimelinesStore = create()( type: 'status', id: newId, rebloggedBy: [], + reblogIds: [], }; } }