code review: refactor

This commit is contained in:
Sinclair Chen 2022-08-04 15:19:00 -07:00
parent 694120216a
commit 506cab6c82
2 changed files with 5 additions and 6 deletions

View File

@ -71,11 +71,10 @@ export function FeedAnswerCommentGroup(props: {
const scrollAndOpenReplyInput = useEvent(
(comment?: Comment, answer?: Answer) => {
setReplyToUser(
comment ?? answer
? {
id: comment?.userId ?? (answer as Answer).userId,
username: comment?.userUsername ?? (answer as Answer).username,
}
comment
? { id: comment.userId, username: comment.userUsername }
: answer
? { id: answer.userId, username: answer.username }
: undefined
)
setShowReply(true)

View File

@ -302,7 +302,7 @@ const GroupMessage = memo(function GroupMessage_(props: {
const first = comments[0]
const { id, userUsername, userName, userAvatarUrl, createdTime } = first
const isCreatorsComment = user && comments[0].userId === user.id
const isCreatorsComment = user && first.userId === user.id
return (
<Col
ref={setRef}