@@ -156,8 +156,6 @@ const MainComment = ({
156
156
comment : MainCommentInfo
157
157
children ?: ReactNode
158
158
} ) => {
159
- const { operationOwned } = useContext ( CommentAreaContext )
160
-
161
159
return (
162
160
< Card
163
161
className = { clsx (
@@ -168,7 +166,7 @@ const MainComment = ({
168
166
< div >
169
167
< CommentHeader comment = { comment } />
170
168
< CommentContent comment = { comment } />
171
- < CommentActions comment = { comment } operationOwned = { operationOwned } />
169
+ < CommentActions comment = { comment } />
172
170
</ div >
173
171
{ children }
174
172
</ Card >
@@ -256,14 +254,13 @@ const CommentContent = ({
256
254
const CommentActions = ( {
257
255
className,
258
256
comment,
259
- operationOwned,
260
257
} : {
261
258
className ?: string
262
259
comment : CommentInfo
263
- operationOwned ?: boolean
264
260
} ) => {
265
261
const [ { userId } ] = useAtom ( authAtom )
266
- const { replyTo, setReplyTo, reload } = useContext ( CommentAreaContext )
262
+ const { operationOwned, replyTo, setReplyTo, reload } =
263
+ useContext ( CommentAreaContext )
267
264
268
265
const [ deleteDialogOpen , setDeleteDialogOpen ] = useState ( false )
269
266
const [ pending , setPending ] = useState ( false )
@@ -301,14 +298,14 @@ const CommentActions = ({
301
298
small
302
299
className = "!font-normal !text-[13px]"
303
300
active = { replyTo === comment }
304
- onClick = { ( ) => setReplyTo ( replyTo !== comment ? comment : undefined ) }
301
+ onClick = { ( ) => setReplyTo ( replyTo === comment ? undefined : comment ) }
305
302
>
306
303
回复
307
304
</ Button >
308
305
{ operationOwned && isMainComment ( comment ) && (
309
306
< CommentTopButton comment = { comment } />
310
307
) }
311
- { userId === comment . uploaderId && (
308
+ { ( operationOwned || userId === comment . uploaderId ) && (
312
309
< Button
313
310
minimal
314
311
small
0 commit comments