Skip to content

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.

Merge branch 'dev' into feat/ui-0.6.0

haitao(lj)fcb6197748e9
diff --cc ui/src/components/Operate/index.tsx
index 846db738,16359c91..00bd65f8
--- a/ui/src/components/Operate/index.tsx
+++ b/ui/src/components/Operate/index.tsx
@@@ -36,12 -31,9 +36,13 @@@ const Index: FC<IProps> = (
}) => {
const { t } = useTranslation('translation', { keyPrefix: 'delete' });
const toast = useToast();
+ const navigate = useNavigate();
const reportModal = useReportModal();
- const closeModal = useReportModal();
+
+ const refershQuestion = () => {
+ callback?.('default');
+ };
+ const closeModal = useReportModal(refershQuestion);
const editUrl =
type === 'answer' ? `/posts/${qid}/${aid}/edit` : `/posts/${qid}/edit`;
diff --cc ui/src/pages/Admin/Users/index.tsx
index 4ad54bc4,3e7ef853..21c8865b
--- a/ui/src/pages/Admin/Users/index.tsx
+++ b/ui/src/pages/Admin/Users/index.tsx
@@@ -117,7 -119,7 +117,7 @@@ const Users: FC = () =>
<thead>
<tr>
<th>{t('name')}</th>
-- {/* <th style={{ width: '12%' }}>{t('reputation')}</th> */}
++ <th style={{ width: '12%' }}>{t('reputation')}</th>
<th style={{ width: '20%' }}>{t('email')}</th>
<th className="text-nowrap" style={{ width: '15%' }}>
{t('created_at')}
@@@ -151,7 -153,7 +151,6 @@@
showReputation={false}
/>
</td>
-- {/* <td>{user.rank}</td> */}
<td className="text-break">{user.e_mail}</td>
<td>
<FormatTime time={user.created_at} />
@@@ -183,28 -185,28 +182,16 @@@
<Icon name="three-dots-vertical" />
</Dropdown.Toggle>
<Dropdown.Menu>
-- {/* <Dropdown.Item>{t('set_new_password')}</Dropdown.Item> */}
<Dropdown.Item
onClick={() => handleAction('status', user)}>
{t('change_status')}
</Dropdown.Item>
- {/* <Dropdown.Item */}
- {/* onClick={() => handleAction('role', user)}> */}
- {/* {t('change_role')} */}
- {/* </Dropdown.Item> */}
- {/* <Dropdown.Divider />
- <Dropdown.Item>{t('show_logs')}</Dropdown.Item> */}
+ <Dropdown.Item
+ onClick={() => handleAction('role', user)}>
+ {t('change_role')}
+ </Dropdown.Item>
- {/* <Dropdown.Divider />
- <Dropdown.Item>{t('show_logs')}</Dropdown.Item> */}
</Dropdown.Menu>
</Dropdown>
--
-- {/* {user.status !== 'deleted' && (
-- <Button
-- className="p-0 btn-no-border"
-- variant="link"
-- onClick={() => handleClick(user)}>
-- {t('change')}
-- </Button>
-- )} */}
</td>
) : null}
</tr>
diff --cc ui/src/pages/Questions/Ask/index.tsx
index a94fb6a2,ed0b93a9..fe074951
--- a/ui/src/pages/Questions/Ask/index.tsx
+++ b/ui/src/pages/Questions/Ask/index.tsx
@@@ -235,8 -234,10 +235,10 @@@ const Ask = () =>
id: qid,
edit_summary: formData.edit_summary.value,
})
- .then(() => {
- navigate(pathFactory.questionLanding(qid, params.title));
+ .then((res) => {
- navigate(`/questions/${qid}`, {
++ navigate(pathFactory.questionLanding(qid, params.title), {
+ state: { isReview: res?.wait_for_review },
+ });
})
.catch((err) => {
if (err.isError) {
diff --cc ui/src/pages/Questions/Detail/index.tsx
index 4728892c,1a4f11b6..62eb3640
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@@ -1,10 -1,15 +1,16 @@@
import { useEffect, useState } from 'react';
import { Container, Row, Col } from 'react-bootstrap';
- import { useParams, useSearchParams, useNavigate } from 'react-router-dom';
+ import {
+ useParams,
+ useSearchParams,
+ useNavigate,
+ useLocation,
+ } from 'react-router-dom';
+ import { useTranslation } from 'react-i18next';
+import Pattern from '@/common/pattern';
import { Pagination, PageTitle } from '@/components';
- import { loggedUserInfoStore } from '@/stores';
+ import { loggedUserInfoStore, toastStore } from '@/stores';
import { scrollTop } from '@/utils';
import { usePageUsers } from '@/hooks';
import type {
@@@ -27,14 -32,10 +33,15 @@@ import './index.scss'
const Index = () => {
const navigate = useNavigate();
+ const { t } = useTranslation('translation');
- const { qid = '', aid = '' } = useParams();
- const [urlSearch] = useSearchParams();
+ const { qid = '', slugPermalink = '' } = useParams();
+ // Compatible with Permalink
+ let { aid = '' } = useParams();
+ if (!aid && Pattern.isAnswerId.test(slugPermalink)) {
+ aid = slugPermalink;
+ }
+ const [urlSearch] = useSearchParams();
const page = Number(urlSearch.get('page') || 0);
const order = urlSearch.get('order') || '';
const [question, setQuestion] = useState<QuestionDetailRes | null>(null);
diff --cc ui/src/pages/Questions/EditAnswer/index.tsx
index faa2fe2d,79506aee..fd731cbd
--- a/ui/src/pages/Questions/EditAnswer/index.tsx
+++ b/ui/src/pages/Questions/EditAnswer/index.tsx
@@@ -110,16 -109,13 +110,19 @@@ const Ask = () =>
id: aid,
edit_summary: formData.description.value,
};
- modifyAnswer(params).then(() => {
+ modifyAnswer(params).then((res) => {
- navigate(`/questions/${qid}/${aid}`, {
- state: { isReview: res?.wait_for_review },
- });
+ navigate(
+ pathFactory.answerLanding({
+ questionId: qid,
+ questionTitle: data?.question?.title,
+ answerId: aid,
+ }),
++ {
++ state: { isReview: res?.wait_for_review },
++ },
+ );
});
};
-
const handleSelectedRevision = (e) => {
const index = e.target.value;
const revision = revisions[index];