Skip to content

Commit

Permalink
Fixes zammad#3789 - Article box opening on tickets with no changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfschmidt authored and thorsteneckel committed Oct 7, 2021
1 parent 9f9ec58 commit a7e0d46
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class App.TicketZoomArticleNew extends App.Controller
@controllerBind('ui:rerender', =>
@adjustedTextarea = false
@defaults = @ui.taskGet('article')
@attachments = @defaults.attachments
@attachments = @defaults.attachments || []
@render()
)

Expand All @@ -117,7 +117,7 @@ class App.TicketZoomArticleNew extends App.Controller

@tokanice(@type)

if @defaults.body or @attachments or @isIE10()
if @defaults.body or @attachments.length > 0 or @isIE10()
@openTextarea(null, true)

tokanice: (type = 'email') ->
Expand Down
35 changes: 35 additions & 0 deletions spec/system/ticket/zoom_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2193,4 +2193,39 @@ def authenticate
end
end
end

context 'Article box opening on tickets with no changes #3789' do
let(:ticket) { create(:ticket, group: Group.find_by(name: 'Users')) }

before do
visit "#ticket/zoom/#{ticket.id}"
end

it 'does not expand the article box without changes' do
refresh
sleep 3
expect(page).to have_no_selector('form.article-add.is-open')
end

it 'does open and close by usage' do
find('.js-textarea').send_keys(' ')
expect(page).to have_selector('form.article-add.is-open')
find('input#global-search').click
expect(page).to have_no_selector('form.article-add.is-open')
end

it 'does open automatically when body is given from sidebar' do
find('.js-textarea').send_keys('test')
wait(5).until { Taskbar.find_by(key: "Ticket-#{ticket.id}").state.dig('article', 'body').present? }
refresh
expect(page).to have_selector('form.article-add.is-open')
end

it 'does open automatically when attachment is given from sidebar' do
page.find('input#fileUpload_1', visible: :all).set(Rails.root.join('test/data/mail/mail001.box'))
wait(5).until { Taskbar.find_by(key: "Ticket-#{ticket.id}").attributes_with_association_ids['attachments'].present? }
refresh
expect(page).to have_selector('form.article-add.is-open')
end
end
end

0 comments on commit a7e0d46

Please sign in to comment.