diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.coffee index 2d038e4e0..d0bcf2a6b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.coffee @@ -271,6 +271,7 @@ class App.TicketZoom extends App.Controller @delay(scrollToDelay, delay, 'scrollToPosition') pagePosition: (params = {}) => + return if @el.is(':hidden') # remember for later return if params.type is 'init' && !@shown @@ -288,6 +289,7 @@ class App.TicketZoom extends App.Controller # scroll to end if new article has been added else if !@last_ticket_article_ids || !_.isEqual(_.sortBy(@last_ticket_article_ids), _.sortBy(@ticket_article_ids)) + App.Event.trigger('ui::ticket::shown', { ticket_id: @ticket_id }) @scrollToPosition('bottom', 100, article_id) # trigger shown to article diff --git a/spec/system/ticket/zoom_spec.rb b/spec/system/ticket/zoom_spec.rb index 35fb32ae1..3324697f3 100644 --- a/spec/system/ticket/zoom_spec.rb +++ b/spec/system/ticket/zoom_spec.rb @@ -1337,6 +1337,25 @@ RSpec.describe 'Ticket zoom', type: :system do end end end + + context 'when long articles are present' do + it 'will properly show the "See more" link if you switch between the ticket and the dashboard on new articles' do + ensure_websocket do + visit "ticket/zoom/#{ticket.id}" + await_empty_ajax_queue + + visit 'dashboard' + expect(page).to have_css("a.js-dashboardMenuItem[data-key='Dashboard'].is-active", wait: 10) + article_id = create(:'ticket/article', ticket: ticket, body: "#{SecureRandom.uuid} #{"lorem ipsum\n" * 200}") + expect(page).to have_css('div.tasks a.is-modified', wait: 10) + + visit "ticket/zoom/#{ticket.id}" + within :active_content do + expect(find("div#article-content-#{article_id.id}")).to have_text('See more') + end + end + end + end end describe 'Macros', authenticated_as: :authenticate do