diff --git a/app/javascript/flavours/glitch/api_types/search.ts b/app/javascript/flavours/glitch/api_types/search.ts index 795cbb2b41..961dd65699 100644 --- a/app/javascript/flavours/glitch/api_types/search.ts +++ b/app/javascript/flavours/glitch/api_types/search.ts @@ -1,4 +1,5 @@ import type { ApiAccountJSON } from './accounts'; +import type { ApiCollectionJSON } from './collections'; import type { ApiStatusJSON } from './statuses'; import type { ApiHashtagJSON } from './tags'; @@ -8,4 +9,5 @@ export interface ApiSearchResultsJSON { accounts: ApiAccountJSON[]; statuses: ApiStatusJSON[]; hashtags: ApiHashtagJSON[]; + collections: ApiCollectionJSON[]; } diff --git a/app/javascript/flavours/glitch/features/compose/components/search.tsx b/app/javascript/flavours/glitch/features/compose/components/search.tsx index f4baf784ff..ace29efab9 100644 --- a/app/javascript/flavours/glitch/features/compose/components/search.tsx +++ b/app/javascript/flavours/glitch/features/compose/components/search.tsx @@ -19,6 +19,7 @@ import { useHistory } from 'react-router-dom'; import { isFulfilled } from '@reduxjs/toolkit'; +import { getCollectionPath } from '@/flavours/glitch/features/collections/utils'; import CancelIcon from '@/material-icons/400-24px/cancel-fill.svg?react'; import CloseIcon from '@/material-icons/400-24px/close.svg?react'; import SearchIcon from '@/material-icons/400-24px/search.svg?react'; @@ -337,6 +338,10 @@ export const Search: React.FC<{ history.push( `/@${result.payload.statuses[0].account.acct}/${result.payload.statuses[0].id}`, ); + } else if (result.payload.collections[0]) { + history.push( + getCollectionPath(result.payload.collections[0].id), + ); } }