A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix(search): complete href for SearchItem answer
haitao(lj)aeb60ffa383a
diff --git a/ui/src/common/interface.ts b/ui/src/common/interface.tsindex 38fb8deb..2ab3afcd 100644--- a/ui/src/common/interface.ts+++ b/ui/src/common/interface.ts@@ -334,6 +334,7 @@ export interface SearchResItem {object_type: string;object: {id: string;+ question_id?: string;title: string;excerpt: string;created_at: number;diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsxindex 8b9d8e6e..ad08aa5e 100644--- a/ui/src/pages/Search/components/SearchItem/index.tsx+++ b/ui/src/pages/Search/components/SearchItem/index.tsx@@ -14,6 +14,10 @@ const Index: FC<Props> = ({ data }) => {if (!data?.object_type) {return null;}+ let itemUrl = `/questions/${data.object.id}`;+ if (data.object_type === 'answer') {+ itemUrl = `/questions/${data.object.question_id}/${data.object.id}`;+ }return (<ListGroupItem className="py-3 px-0"><div className="mb-2 clearfix">@@ -23,9 +27,7 @@ const Index: FC<Props> = ({ data }) => {style={{ marginTop: '2px' }}>{data.object_type === 'question' ? 'Q' : 'A'}</Badge>- <a- className="h5 mb-0 link-dark text-break"- href={`/questions/${data.object.id}`}>+ <a className="h5 mb-0 link-dark text-break" href={itemUrl}>{data.object.title}{data.object.status === 'closed'? ` [${t('closed', { keyPrefix: 'question' })}]`