mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Actions working for #638
This commit is contained in:
@@ -7,11 +7,10 @@ import ComposeRoot from '@screens/Compose/Root'
|
||||
import { formatText } from '@screens/Compose/utils/processText'
|
||||
import { useQueryClient } from '@tanstack/react-query'
|
||||
import { handleError } from '@utils/api/helpers'
|
||||
import apiInstance from '@utils/api/instance'
|
||||
import { RootStackScreenProps } from '@utils/navigation/navigators'
|
||||
import { useInstanceQuery } from '@utils/queryHooks/instance'
|
||||
import { usePreferencesQuery } from '@utils/queryHooks/preferences'
|
||||
import { SearchResult } from '@utils/queryHooks/search'
|
||||
import { searchFetchToot, SearchResult } from '@utils/queryHooks/search'
|
||||
import { useTimelineMutation } from '@utils/queryHooks/timeline'
|
||||
import {
|
||||
getAccountStorage,
|
||||
@@ -157,23 +156,11 @@ const ScreenCompose: React.FC<RootStackScreenProps<'Screen-Compose'>> = ({
|
||||
content: params.accts.map(acct => `@${acct}`).join(' ') + ' ',
|
||||
disableDebounce: true
|
||||
})
|
||||
apiInstance<SearchResult>({
|
||||
version: 'v2',
|
||||
method: 'get',
|
||||
url: 'search',
|
||||
params: {
|
||||
q: params.incomingStatus.uri,
|
||||
type: 'statuses',
|
||||
limit: 1,
|
||||
resolve: true
|
||||
searchFetchToot(params.incomingStatus.uri).then(status => {
|
||||
if (status?.uri === params.incomingStatus.uri) {
|
||||
composeDispatch({ type: 'updateReply', payload: status })
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
if (res.body.statuses[0]?.uri === params.incomingStatus.uri) {
|
||||
composeDispatch({ type: 'updateReply', payload: res.body.statuses[0] })
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
break
|
||||
case 'conversation':
|
||||
formatText({
|
||||
|
@@ -59,7 +59,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
|
||||
const finalData = useRef<Mastodon.Status[]>([{ ...toot, _level: 0, _remote: false }])
|
||||
const highlightIndex = useRef<number>(0)
|
||||
const queryKey: { [key: string]: QueryKeyTimeline } = {
|
||||
const queryKey: { local: QueryKeyTimeline; remote: QueryKeyTimeline } = {
|
||||
local: ['Timeline', { page: 'Toot', toot: toot.id, remote: false }],
|
||||
remote: ['Timeline', { page: 'Toot', toot: toot.id, remote: true }]
|
||||
}
|
||||
@@ -199,7 +199,12 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
if (finalData.current?.length < data.pages[0].body.length) {
|
||||
finalData.current = data.pages[0].body.map(remote => {
|
||||
const localMatch = finalData.current?.find(local => local.uri === remote.uri)
|
||||
return localMatch || { ...remote, _remote: true }
|
||||
if (localMatch) {
|
||||
return localMatch
|
||||
} else {
|
||||
remote._remote = true
|
||||
return remote
|
||||
}
|
||||
})
|
||||
setHasRemoteContent(true)
|
||||
}
|
||||
@@ -302,7 +307,7 @@ const TabSharedToot: React.FC<TabSharedStackScreenProps<'Tab-Shared-Toot'>> = ({
|
||||
>
|
||||
<TimelineDefault
|
||||
item={item}
|
||||
queryKey={queryKey.local}
|
||||
queryKey={item._remote ? queryKey.remote : queryKey.local}
|
||||
rootQueryKey={rootQueryKey}
|
||||
highlighted={toot.id === item.id}
|
||||
isConversation={toot.id !== item.id}
|
||||
|
Reference in New Issue
Block a user