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: question detail show delete msg for admin user

shuai85961cb788a4
diff --git a/ui/src/pages/Questions/Detail/components/Alert/index.tsx b/ui/src/pages/Questions/Detail/components/Alert/index.tsx
index 07d731bd..e421fcf7 100644
--- a/ui/src/pages/Questions/Detail/components/Alert/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/Alert/index.tsx
@@ -10,38 +10,38 @@ interface Props {
const Index: FC<Props> = ({ data }) => {
const { t } = useTranslation();
return (
- <Alert className="mb-4" variant="info">
- <div>
- {data.operation_msg.indexOf('http') > -1 ? (
- <p>
- {data.operation_description}{' '}
- <a href={data.operation_msg} style={{ color: '#055160' }}>
- <strong>{t('question_detail.show_exist')}</strong>
- </a>
- </p>
- ) : (
- <p>
- {data.operation_msg
- ? data.operation_msg
- : data.operation_description}
- </p>
- )}
- <div className="fs-14">
- {t('question_detail.closed_in')}{' '}
- <time
- dateTime={dayjs.unix(data.operation_time).tz().toISOString()}
- title={dayjs
- .unix(data.operation_time)
- .tz()
- .format(t('dates.long_date_with_time'))}>
- {dayjs
- .unix(data.operation_time)
- .tz()
- .format(t('dates.long_date_with_year'))}
- </time>
- .
+ <Alert className="mb-4" variant={data.level}>
+ {data.level === 'info' ? (
+ <div>
+ {data.msg.indexOf('http') > -1 ? (
+ <p>
+ {data.description}{' '}
+ <a href={data.msg} style={{ color: '#055160' }}>
+ <strong>{t('question_detail.show_exist')}</strong>
+ </a>
+ </p>
+ ) : (
+ <p>{data.msg ? data.msg : data.description}</p>
+ )}
+ <div className="fs-14">
+ {t('question_detail.closed_in')}{' '}
+ <time
+ dateTime={dayjs.unix(data.time).tz().toISOString()}
+ title={dayjs
+ .unix(data.time)
+ .tz()
+ .format(t('dates.long_date_with_time'))}>
+ {dayjs
+ .unix(data.time)
+ .tz()
+ .format(t('dates.long_date_with_year'))}
+ </time>
+ .
+ </div>
</div>
- </div>
+ ) : (
+ data.msg
+ )}
</Alert>
);
};
diff --git a/ui/src/pages/Questions/Detail/index.tsx b/ui/src/pages/Questions/Detail/index.tsx
index 14f14bda..289513c7 100644
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@ -183,9 +183,7 @@ const Index = () => {
<Container className="pt-4 mt-2 mb-5 questionDetailPage">
<Row className="justify-content-center">
<Col xxl={7} lg={8} sm={12} className="mb-5 mb-md-0">
- {question?.operation?.operation_type && (
- <Alert data={question.operation} />
- )}
+ {question?.operation?.level && <Alert data={question.operation} />}
{isLoading ? (
<ContentLoader />
) : (