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: delete answers pnly show to author and admin and has searchparams aid

shuai487b45416577
diff --git a/ui/src/pages/Questions/Detail/index.tsx b/ui/src/pages/Questions/Detail/index.tsx
index 289513c7..87c27caf 100644
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@ -56,6 +56,7 @@ const Index = () => {
const { setUsers } = usePageUsers();
const userInfo = loggedUserInfoStore((state) => state.user);
const isAuthor = userInfo?.username === question?.user_info?.username;
+ const isAdmin = userInfo?.is_admin;
const isLogged = Boolean(userInfo?.access_token);
const { state: locationState } = useLocation();
@@ -76,6 +77,19 @@ const Index = () => {
page_size: 999,
});
if (res) {
+ res.list = res.list?.filter((v) => {
+ // delete answers pnly show to author and admin and has searchparams aid
+ if (v.status === 10) {
+ if ((isAuthor || isAdmin) && aid === v.id) {
+ return v;
+ }
+ return null;
+ }
+
+ return v;
+ });
+
+ console.log(res);
setAnswers(res);
if (page > 0 || order) {
// scroll into view;