Fixes #3052 - Ticket follow ups does not always provide "see more" link on new articles.

This commit is contained in:
Rolf Schmidt 2021-01-12 08:45:34 +01:00 committed by Thorsten Eckel
parent 71ff497dfc
commit 375b6242ad
2 changed files with 21 additions and 0 deletions

View file

@ -271,6 +271,7 @@ class App.TicketZoom extends App.Controller
@delay(scrollToDelay, delay, 'scrollToPosition') @delay(scrollToDelay, delay, 'scrollToPosition')
pagePosition: (params = {}) => pagePosition: (params = {}) =>
return if @el.is(':hidden')
# remember for later # remember for later
return if params.type is 'init' && !@shown 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 # 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)) 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) @scrollToPosition('bottom', 100, article_id)
# trigger shown to article # trigger shown to article

View file

@ -1337,6 +1337,25 @@ RSpec.describe 'Ticket zoom', type: :system do
end end
end 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 end
describe 'Macros', authenticated_as: :authenticate do describe 'Macros', authenticated_as: :authenticate do