Fixes #3568 - Duplicated article after bulk action was executed for newly created tickets without a browser refresh in between.
This commit is contained in:
parent
c346d8b66b
commit
8b83bd4c1c
2 changed files with 65 additions and 16 deletions
|
@ -563,6 +563,10 @@ class App.TicketCreate extends App.Controller
|
||||||
ticket.save(
|
ticket.save(
|
||||||
done: ->
|
done: ->
|
||||||
|
|
||||||
|
# Reset article after ticket create, to avoid unwanted sideeffects at other places.
|
||||||
|
localTicket = App.Ticket.findNative(@id)
|
||||||
|
localTicket.article = undefined
|
||||||
|
|
||||||
# notify UI
|
# notify UI
|
||||||
ui.notify
|
ui.notify
|
||||||
type: 'success'
|
type: 'success'
|
||||||
|
|
|
@ -232,7 +232,8 @@ RSpec.describe 'Ticket views', type: :system do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'bulk note', authenticated_as: :user do
|
context 'when performing a Bulk action' do
|
||||||
|
context 'when creating a Note', authenticated_as: :user do
|
||||||
let(:group) { create :group }
|
let(:group) { create :group }
|
||||||
let(:user) { create :admin, groups: [group] }
|
let(:user) { create :admin, groups: [group] }
|
||||||
let!(:ticket1) { create(:ticket, state_name: 'open', owner: user, group: group) }
|
let!(:ticket1) { create(:ticket, state_name: 'open', owner: user, group: group) }
|
||||||
|
@ -255,6 +256,50 @@ RSpec.describe 'Ticket views', type: :system do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# https://github.com/zammad/zammad/issues/3568
|
||||||
|
# We need a manual ticket creation to test the correct behaviour of the bulk functionality, because of some
|
||||||
|
# leftovers after the creation in the the javascript assets store.
|
||||||
|
context 'when performed a manual Ticket creation', authenticated_as: :agent do
|
||||||
|
let(:customer) { create(:customer) }
|
||||||
|
let(:group) { Group.find_by(name: 'Users') }
|
||||||
|
let(:agent) { create(:agent, groups: [group]) }
|
||||||
|
let!(:template) { create(:template, :dummy_data, group: group, owner: agent, customer: customer) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
visit 'ticket/create'
|
||||||
|
|
||||||
|
within(:active_content) do
|
||||||
|
use_template(template)
|
||||||
|
|
||||||
|
click('.js-submit')
|
||||||
|
|
||||||
|
find('.ticket-article-item')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'check that no duplicated article was created after usage of bulk action' do
|
||||||
|
click('.menu-item[href="#ticket/view"]')
|
||||||
|
|
||||||
|
created_ticket_id = Ticket.last.id
|
||||||
|
|
||||||
|
within(:active_content) do
|
||||||
|
click("tr[data-id='#{created_ticket_id}'] .js-checkbox-field")
|
||||||
|
|
||||||
|
find('select[name="priority_id"] option[value="1"]').select_option
|
||||||
|
|
||||||
|
click('.js-confirm')
|
||||||
|
click('.js-submit')
|
||||||
|
|
||||||
|
await_empty_ajax_queue
|
||||||
|
|
||||||
|
# Check if still only one article exists on the ticket.
|
||||||
|
click("tr[data-id='#{created_ticket_id}'] a")
|
||||||
|
expect(page).to have_css('.ticket-article-item', count: 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'Setting "ui_table_group_by_show_count"', authenticated_as: :authenticate, db_strategy: :reset do
|
context 'Setting "ui_table_group_by_show_count"', authenticated_as: :authenticate, db_strategy: :reset do
|
||||||
let!(:ticket1) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
let!(:ticket1) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
||||||
let!(:ticket2) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
let!(:ticket2) { create(:ticket, group: Group.find_by(name: 'Users')) }
|
||||||
|
|
Loading…
Reference in a new issue