Skip to content

Commit

Permalink
fix(tickets): not able to set status once closed
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jul 16, 2022
1 parent 657b392 commit a8fb844
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
12 changes: 11 additions & 1 deletion src/client/containers/Tickets/SingleTicketContainer.jsx
Expand Up @@ -274,6 +274,16 @@ 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
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)
}
}

return (
<div className={'uk-clearfix uk-position-relative'} style={{ width: '100%', height: '100vh' }}>
Expand All @@ -292,7 +302,7 @@ class SingleTicketContainer extends React.Component {
status={this.ticket.status}
socket={this.props.socket}
onStatusChange={status => (this.ticket.status = status)}
hasPerm={hasTicketUpdate}
hasPerm={hasTicketStatusUpdate()}
/>
</div>
{/* Left Side */}
Expand Down
8 changes: 4 additions & 4 deletions src/public/js/modules/helpers.js
Expand Up @@ -1464,13 +1464,13 @@ define([
}

helpers.setTimezone = function () {
var $timezone = $('#__timezone')
var timezone
const $timezone = $('#__timezone')
let timezone
if ($timezone.length < 1) {
Cookies.set('$trudesk:timezone', 'America/New_York')
} else {
timezone = Cookies.get('$trudesk:timezone')
var __timezone = $timezone.text()
const __timezone = $timezone.text()
if (!timezone) {
Cookies.set('$trudesk:timezone', __timezone)
} else if (timezone !== __timezone) {
Expand All @@ -1485,7 +1485,7 @@ define([
}

helpers.getTimezone = function () {
var timezone = Cookies.get('$trudesk:timezone')
let timezone = Cookies.get('$trudesk:timezone')
if (!timezone) {
timezone = 'America/New_York'
}
Expand Down

0 comments on commit a8fb844

Please sign in to comment.