File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
ui/src/pages/Questions/Detail Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ const Index = () => {
56
56
const { setUsers } = usePageUsers ( ) ;
57
57
const userInfo = loggedUserInfoStore ( ( state ) => state . user ) ;
58
58
const isAuthor = userInfo ?. username === question ?. user_info ?. username ;
59
+ const isAdmin = userInfo ?. is_admin ;
59
60
const isLogged = Boolean ( userInfo ?. access_token ) ;
60
61
const { state : locationState } = useLocation ( ) ;
61
62
@@ -76,6 +77,19 @@ const Index = () => {
76
77
page_size : 999 ,
77
78
} ) ;
78
79
if ( res ) {
80
+ res . list = res . list ?. filter ( ( v ) => {
81
+ // delete answers pnly show to author and admin and has searchparams aid
82
+ if ( v . status === 10 ) {
83
+ if ( ( isAuthor || isAdmin ) && aid === v . id ) {
84
+ return v ;
85
+ }
86
+ return null ;
87
+ }
88
+
89
+ return v ;
90
+ } ) ;
91
+
92
+ console . log ( res ) ;
79
93
setAnswers ( res ) ;
80
94
if ( page > 0 || order ) {
81
95
// scroll into view;
You can’t perform that action at this time.
0 commit comments