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.

fix: review close action

shuaid2c53e861367
diff --git a/ui/src/hooks/useReportModal/index.tsx b/ui/src/hooks/useReportModal/index.tsx
index 24d26b02..88cd2442 100644
--- a/ui/src/hooks/useReportModal/index.tsx
+++ b/ui/src/hooks/useReportModal/index.tsx
@@ -38,7 +38,8 @@ interface Params {
type: Type.ReportType;
id: string;
title?: string;
- action: Type.ReportAction | 'flag_review_close';
+ action: Type.ReportAction;
+ source?: string;
}
const useReportModal = (callback?: () => void) => {
@@ -70,7 +71,11 @@ const useReportModal = (callback?: () => void) => {
}, []);
const getList = ({ type, action, isBackend }: Params) => {
// @ts-ignore
- reportList({ type, action, isBackend }).then((res) => {
+ reportList({
+ type,
+ action,
+ isBackend,
+ }).then((res) => {
setList(res);
setShow(true);
});
@@ -120,6 +125,18 @@ const useReportModal = (callback?: () => void) => {
return;
}
if (params.type === 'question' && params.action === 'close') {
+ if (params?.source === 'review') {
+ putFlagReviewAction({
+ flag_id: params.id,
+ operation_type: 'close_post',
+ close_type: reportType.type,
+ close_msg: content.value,
+ }).then(() => {
+ onClose();
+ asyncCallback();
+ });
+ return;
+ }
closeQuestion({
id: params.id,
close_type: reportType.type,
@@ -130,19 +147,6 @@ const useReportModal = (callback?: () => void) => {
});
return;
}
-
- if (params.type === 'question' && params.action === 'flag_review_close') {
- putFlagReviewAction({
- flag_id: params.id,
- operation_type: 'close_post',
- close_type: reportType.type,
- close_msg: content.value,
- }).then(() => {
- onClose();
- asyncCallback();
- });
- return;
- }
if (!params.isBackend && params.action === 'flag') {
rCaptcha.check(() => {
const flagReq = {
diff --git a/ui/src/pages/Review/components/ApproveDropdown/index.tsx b/ui/src/pages/Review/components/ApproveDropdown/index.tsx
index 85be41db..05f92296 100644
--- a/ui/src/pages/Review/components/ApproveDropdown/index.tsx
+++ b/ui/src/pages/Review/components/ApproveDropdown/index.tsx
@@ -111,7 +111,8 @@ const Index: FC<IProps> = ({
closeModal.onShow({
type: 'question',
id: itemData?.flag_id || '',
- action: 'flag_review_close',
+ action: 'close',
+ source: 'review',
});
}