This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/test by this push:
new 235c69e9 fix: update search type
235c69e9 is described below
commit 235c69e9b9eff6fca21eba37c7a81cc0dcc9f767
Author: shuai <[email protected]>
AuthorDate: Tue Sep 2 17:00:12 2025 +0800
fix: update search type
---
ui/src/pages/Search/components/SearchItem/index.tsx | 2 +-
ui/src/router/routes.ts | 3 ---
ui/src/utils/guard.ts | 18 ------------------
3 files changed, 1 insertion(+), 22 deletions(-)
diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx
b/ui/src/pages/Search/components/SearchItem/index.tsx
index e74caa4b..16391771 100644
--- a/ui/src/pages/Search/components/SearchItem/index.tsx
+++ b/ui/src/pages/Search/components/SearchItem/index.tsx
@@ -68,7 +68,7 @@ const Index: FC<Props> = ({ data }) => {
<span
className="float-start me-2 badge text-bg-dark"
style={{ marginTop: '2px' }}>
- {data.object_type === 'question' ? 'Q' : 'A'}
+ {t(data.object_type, { keyPrefix: 'btns' })}
</span>
<Link className="h5 mb-0 link-dark text-break" to={itemUrl}>
<HighlightText text={data.object.title} keywords={keywords} />
diff --git a/ui/src/router/routes.ts b/ui/src/router/routes.ts
index 4b98f205..3e324815 100644
--- a/ui/src/router/routes.ts
+++ b/ui/src/router/routes.ts
@@ -123,9 +123,6 @@ const routes: RouteNode[] = [
{
path: '/search',
page: 'pages/Search',
- guard: () => {
- return guard.googleSnapshotRedirect();
- },
},
// tags
{
diff --git a/ui/src/utils/guard.ts b/ui/src/utils/guard.ts
index 3765d693..59011017 100644
--- a/ui/src/utils/guard.ts
+++ b/ui/src/utils/guard.ts
@@ -391,24 +391,6 @@ export const initAppSettingsStore = async () => {
}
};
-export const googleSnapshotRedirect = () => {
- const gr: TGuardResult = { ok: false };
- const searchStr = new URLSearchParams(window.location.search)?.get('q') ||
'';
- if (window.location.host !== 'webcache.googleusercontent.com') {
- return gr;
- }
- if (searchStr.indexOf('cache:') === 0 && searchStr.includes(':http')) {
- const redirectUrl = `http${searchStr.split(':http')[1]}`;
- const pathname = redirectUrl.replace(new URL(redirectUrl).origin, '');
-
- gr.ok = false;
- gr.redirect = pathname || '/';
- return gr;
- }
-
- return gr;
-};
-
export const askRedirect = () => {
const queryString = window.location.search;