feat: allow searching for statuses (#632)

This commit is contained in:
Daniel Roe 2022-12-29 15:44:26 +01:00 committed by GitHub
parent 86a604ae9c
commit 12280afe70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 7 deletions

View file

@ -111,6 +111,16 @@ export function getStatusRoute(status: Status) {
})
}
export function getTagRoute(tag: string) {
return useRouter().resolve({
name: 'tag',
params: {
server: currentServer.value,
tag,
},
})
}
export function getStatusPermalinkRoute(status: Status) {
return status.url ? withoutProtocol(status.url) : null
}

View file

@ -7,6 +7,7 @@ export interface UseSearchOptions {
export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
const done = ref(false)
const masto = useMasto()
const loading = ref(false)
const statuses = ref<Status[]>([])
const accounts = ref<Account[]>([])
@ -24,7 +25,7 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
* Based on the source it seems like modifying the params when calling next would result in a new search,
* but that doesn't seem to be the case. So instead we just create a new paginator with the new params.
*/
paginator = useMasto().search({ q: unref(query), type: unref(options?.type) })
paginator = masto.search({ q: unref(query), resolve: true, type: unref(options?.type) })
const nextResults = await paginator.next()
done.value = nextResults.done || false