Skip to content

Commit

Permalink
fix(layout): Dont show comments on tickets if no metadata exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Oct 11, 2024
1 parent 948de7b commit 420b7e0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
8 changes: 1 addition & 7 deletions src/components/page/ticket/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ const TicketCommentForm = ({
console.log(post_url)
let comment_class = 'comment-type-default comment-form'

let action_keyword = 'POST'

if( 'PUT' in metadata.actions ) {

action_keyword = 'PUT'

}
let action_keyword = Object.keys(metadata.actions)[0]


const [task_comment, setTaskComment] = useState(false)
Expand Down
1 change: 1 addition & 0 deletions src/components/page/ticket/Comments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ const TicketComments = ({
}

return (
metadata &&
<div className={discussion_class}>
<div className={comment_class}>

Expand Down
22 changes: 12 additions & 10 deletions src/layout/Ticket.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ const Ticket = ({
</li>
)
})}
<li>
<TicketCommentForm
metadata={comment_metadata}
post_url = {page_data['_urls']['comments']}
ticket_id={page_data['id']}
commentCallback={() => {
setRelaod(true)
}}
/>
</li>
{comment_metadata != null &&
<li>
<TicketCommentForm
metadata={comment_metadata}
post_url = {page_data['_urls']['comments']}
ticket_id={page_data['id']}
commentCallback={() => {
setRelaod(true)
}}
/>
</li>
}
</ul>
</div>
</div>
Expand Down

0 comments on commit 420b7e0

Please sign in to comment.