Collections: Handle URLs in search (#39182)
This commit is contained in:
parent
888011de69
commit
d229157f19
@ -1,4 +1,5 @@
|
|||||||
import type { ApiAccountJSON } from './accounts';
|
import type { ApiAccountJSON } from './accounts';
|
||||||
|
import type { ApiCollectionJSON } from './collections';
|
||||||
import type { ApiStatusJSON } from './statuses';
|
import type { ApiStatusJSON } from './statuses';
|
||||||
import type { ApiHashtagJSON } from './tags';
|
import type { ApiHashtagJSON } from './tags';
|
||||||
|
|
||||||
@ -8,4 +9,5 @@ export interface ApiSearchResultsJSON {
|
|||||||
accounts: ApiAccountJSON[];
|
accounts: ApiAccountJSON[];
|
||||||
statuses: ApiStatusJSON[];
|
statuses: ApiStatusJSON[];
|
||||||
hashtags: ApiHashtagJSON[];
|
hashtags: ApiHashtagJSON[];
|
||||||
|
collections: ApiCollectionJSON[];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import { useHistory } from 'react-router-dom';
|
|||||||
|
|
||||||
import { isFulfilled } from '@reduxjs/toolkit';
|
import { isFulfilled } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
|
import { getCollectionPath } from '@/mastodon/features/collections/utils';
|
||||||
import CancelIcon from '@/material-icons/400-24px/cancel-fill.svg?react';
|
import CancelIcon from '@/material-icons/400-24px/cancel-fill.svg?react';
|
||||||
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
|
import CloseIcon from '@/material-icons/400-24px/close.svg?react';
|
||||||
import SearchIcon from '@/material-icons/400-24px/search.svg?react';
|
import SearchIcon from '@/material-icons/400-24px/search.svg?react';
|
||||||
@ -337,6 +338,10 @@ export const Search: React.FC<{
|
|||||||
history.push(
|
history.push(
|
||||||
`/@${result.payload.statuses[0].account.acct}/${result.payload.statuses[0].id}`,
|
`/@${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),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user