Fixes #2985 - Adding a note during bulk operation only works for one ticket
This commit is contained in:
parent
73f6a98e29
commit
41bba5dda3
2 changed files with 121 additions and 90 deletions
|
@ -1575,6 +1575,15 @@ class BulkForm extends App.Controller
|
|||
if _.isEmpty(ticket.title)
|
||||
ticket.title = '-'
|
||||
|
||||
@saveTicketArticle(ticket, article)
|
||||
|
||||
@holder.find('.table-overview').find('[name="bulk"]:checked').prop('checked', false)
|
||||
App.Event.trigger 'notify', {
|
||||
type: 'success'
|
||||
msg: App.i18n.translateContent('Bulk action executed!')
|
||||
}
|
||||
|
||||
saveTicketArticle: (ticket, article) =>
|
||||
ticket.save(
|
||||
done: (r) =>
|
||||
@bulkCountIndex++
|
||||
|
@ -1603,11 +1612,6 @@ class BulkForm extends App.Controller
|
|||
}
|
||||
)
|
||||
|
||||
@holder.find('.table-overview').find('[name="bulk"]:checked').prop('checked', false)
|
||||
App.Event.trigger 'notify', {
|
||||
type: 'success'
|
||||
msg: App.i18n.translateContent('Bulk action executed!')
|
||||
}
|
||||
|
||||
class App.OverviewSettings extends App.ControllerModal
|
||||
buttonClose: true
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'Ticket views', type: :system do
|
||||
|
||||
context 'macros' do
|
||||
let!(:group1) { create :group }
|
||||
let!(:group2) { create :group }
|
||||
let!(:macro_without_group) { create :macro }
|
||||
|
@ -86,3 +86,30 @@ RSpec.describe 'Ticket views', type: :system do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'bulk note', authenticated_as: :user do
|
||||
let(:group) { create :group }
|
||||
let(:user) { create :admin, groups: [group] }
|
||||
let!(:ticket1) { create(:ticket, state_name: 'open', owner: user, group: group) }
|
||||
let!(:ticket2) { create(:ticket, state_name: 'open', owner: user, group: group) }
|
||||
let(:note) { Faker::Lorem.sentence }
|
||||
|
||||
it 'adds note to all selected tickets' do
|
||||
visit 'ticket/view/my_assigned'
|
||||
|
||||
within :active_content do
|
||||
all('.js-checkbox-field', count: 2).each(&:click)
|
||||
click '.js-confirm'
|
||||
find('.js-confirm-step textarea').fill_in with: note
|
||||
click '.js-submit'
|
||||
end
|
||||
|
||||
await_empty_ajax_queue
|
||||
|
||||
expect([
|
||||
ticket1.articles.last&.body,
|
||||
ticket2.articles.last&.body
|
||||
]).to be_all note
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue