Skip to content

Commit a8fb844

Browse files
committed
fix(tickets): not able to set status once closed
1 parent 657b392 commit a8fb844

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/client/containers/Tickets/SingleTicketContainer.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,16 @@ class SingleTicketContainer extends React.Component {
274274

275275
// Perms
276276
const hasTicketUpdate = this.ticket && this.ticket.status !== 3 && helpers.canUser('tickets:update')
277+
const hasTicketStatusUpdate = () => {
278+
const isAgent = this.props.sessionUser.role.isAgent
279+
const isAdmin = this.props.sessionUser.role.isAdmin
280+
if (isAgent || isAdmin) {
281+
return helpers.canUser('tickets:update')
282+
} else {
283+
if (!this.ticket) return false
284+
return helpers.hasPermOverRole(this.ticket.owner.role, this.sessionUser.role, 'tickets:update', false)
285+
}
286+
}
277287

278288
return (
279289
<div className={'uk-clearfix uk-position-relative'} style={{ width: '100%', height: '100vh' }}>
@@ -292,7 +302,7 @@ class SingleTicketContainer extends React.Component {
292302
status={this.ticket.status}
293303
socket={this.props.socket}
294304
onStatusChange={status => (this.ticket.status = status)}
295-
hasPerm={hasTicketUpdate}
305+
hasPerm={hasTicketStatusUpdate()}
296306
/>
297307
</div>
298308
{/* Left Side */}

src/public/js/modules/helpers.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,13 +1464,13 @@ define([
14641464
}
14651465

14661466
helpers.setTimezone = function () {
1467-
var $timezone = $('#__timezone')
1468-
var timezone
1467+
const $timezone = $('#__timezone')
1468+
let timezone
14691469
if ($timezone.length < 1) {
14701470
Cookies.set('$trudesk:timezone', 'America/New_York')
14711471
} else {
14721472
timezone = Cookies.get('$trudesk:timezone')
1473-
var __timezone = $timezone.text()
1473+
const __timezone = $timezone.text()
14741474
if (!timezone) {
14751475
Cookies.set('$trudesk:timezone', __timezone)
14761476
} else if (timezone !== __timezone) {
@@ -1485,7 +1485,7 @@ define([
14851485
}
14861486

14871487
helpers.getTimezone = function () {
1488-
var timezone = Cookies.get('$trudesk:timezone')
1488+
let timezone = Cookies.get('$trudesk:timezone')
14891489
if (!timezone) {
14901490
timezone = 'America/New_York'
14911491
}

0 commit comments

Comments
 (0)