From 46a819e7647a47cfc9790455afaf26b4a491bcaa Mon Sep 17 00:00:00 2001 From: Echo Date: Wed, 27 May 2026 15:13:38 +0200 Subject: [PATCH] [Glitch] Collections: Handle URLs in search Port d229157f193e1394718151c5048e2e2857dee46d to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/api_types/search.ts | 2 ++ .../flavours/glitch/features/compose/components/search.tsx | 5 +++++ 2 files changed, 7 insertions(+) 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), + ); } }