Fixes #2853 regression - Deletion of notes impossible if internal and communication = true

This commit is contained in:
Mantas 2020-11-19 18:01:07 +02:00 committed by Thorsten Eckel
parent 492eb1c883
commit cca33e4b5e
4 changed files with 6 additions and 6 deletions

View file

@ -43,7 +43,7 @@ class Delete
@deletableForAgent: (actions, ticket, article, ui) ->
return false if ticket.currentView() is 'customer'
return false if article.created_by_id != App.User.current()?.id
return false if article.type.communication
return false if article.type.communication && !article.internal
true

View file

@ -29,7 +29,7 @@ class Ticket::ArticlePolicy < ApplicationPolicy
return not_authorized('you can only delete your own notes')
end
if record.type.communication?
if record.type.communication? && !record.internal?
return not_authorized('communication articles cannot be deleted')
end

View file

@ -592,7 +592,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
include_examples 'deleting',
item: 'article_note_communication_self',
now: false, later: false, much_later: false
now: true, later: true, much_later: false
include_examples 'deleting',
item: 'article_note_communication_other',
@ -620,7 +620,7 @@ AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
include_examples 'deleting',
item: 'article_note_communication_self',
now: false, later: false, much_later: false
now: true, later: true, much_later: false
include_examples 'deleting',
item: 'article_note_communication_other',

View file

@ -368,7 +368,7 @@ RSpec.describe 'Ticket zoom', type: :system do
include_examples 'deleting ticket article',
item: 'article_note_communication_self',
now: false, later: false, much_later: false
now: true, later: true, much_later: false
include_examples 'deleting ticket article',
item: 'article_note_communication_other',
@ -396,7 +396,7 @@ RSpec.describe 'Ticket zoom', type: :system do
include_examples 'deleting ticket article',
item: 'article_note_communication_self',
now: false, later: false, much_later: false
now: true, later: true, much_later: false
include_examples 'deleting ticket article',
item: 'article_note_communication_other',