Fixed issue #2813 - Useless display of delete icon below note.
This commit is contained in:
parent
3d00f4d25b
commit
7225899cf9
2 changed files with 22 additions and 9 deletions
|
@ -2,14 +2,27 @@ class Delete
|
|||
@action: (actions, ticket, article, ui) ->
|
||||
return actions if ui.permissionCheck('ticket.customer')
|
||||
|
||||
if article.type.name is 'note'
|
||||
if App.User.current()?.id == article.created_by_id && ui.permissionCheck('ticket.agent')
|
||||
actions.push {
|
||||
name: 'delete'
|
||||
type: 'delete'
|
||||
icon: 'trash'
|
||||
href: '#'
|
||||
}
|
||||
return actions if article.type.name isnt 'note'
|
||||
|
||||
return actions if App.User.current()?.id != article.created_by_id
|
||||
|
||||
return actions if !ui.permissionCheck('ticket.agent')
|
||||
|
||||
# return if article is older then 10 minutes
|
||||
created_at = Date.parse(article.created_at)
|
||||
time_to_show = 600000 - (Date.parse(new Date()) - created_at)
|
||||
|
||||
return actions if time_to_show <= 0
|
||||
|
||||
actions.push {
|
||||
name: 'delete'
|
||||
type: 'delete'
|
||||
icon: 'trash'
|
||||
href: '#'
|
||||
}
|
||||
|
||||
# rerender ations in 10 minutes again to hide delete action of article
|
||||
ui.delay(ui.render, time_to_show, 'actions-rerender')
|
||||
|
||||
actions
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class App.TicketZoomArticleActions extends App.Controller
|
|||
super
|
||||
@render()
|
||||
|
||||
render: ->
|
||||
render: =>
|
||||
actions = @actionRow(@ticket, @article)
|
||||
|
||||
if actions
|
||||
|
|
Loading…
Reference in a new issue