Skip to content

Commit

Permalink
fix(tickets): single ticket ui crash
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel authored Jul 21, 2022
1 parent 14b95b5 commit 16c2b24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/containers/Tickets/SingleTicketContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,13 +275,13 @@ class SingleTicketContainer extends React.Component {
// Perms
const hasTicketUpdate = this.ticket && this.ticket.status !== 3 && helpers.canUser('tickets:update')
const hasTicketStatusUpdate = () => {
const isAgent = this.props.sessionUser.role.isAgent
const isAdmin = this.props.sessionUser.role.isAdmin
const isAgent = this.props.sessionUser ? this.props.sessionUser.role.isAgent : false
const isAdmin = this.props.sessionUser ? this.props.sessionUser.role.isAdmin : false
if (isAgent || isAdmin) {
return helpers.canUser('tickets:update')
} else {
if (!this.ticket) return false
return helpers.hasPermOverRole(this.ticket.owner.role, this.sessionUser.role, 'tickets:update', false)
if (!this.ticket || !this.props.sessionUser) return false
return helpers.hasPermOverRole(this.ticket.owner.role, this.props.sessionUser.role, 'tickets:update', false)
}
}

Expand Down

0 comments on commit 16c2b24

Please sign in to comment.