Fixes #3267 - Issue opened in overview doesn't have previous/next buttons if it was opened before
This commit is contained in:
parent
e85f80aa2c
commit
498e5ba487
2 changed files with 50 additions and 6 deletions
|
@ -19,7 +19,7 @@ class App.TicketZoom extends App.Controller
|
|||
@authenticateCheckRedirect()
|
||||
|
||||
@formMeta = undefined
|
||||
@ticket_id = params.ticket_id
|
||||
@ticket_id = parseInt(params.ticket_id)
|
||||
@article_id = params.article_id
|
||||
@sidebarState = {}
|
||||
|
||||
|
@ -254,6 +254,11 @@ class App.TicketZoom extends App.Controller
|
|||
return if !@attributeBar
|
||||
@attributeBar.start()
|
||||
|
||||
if @renderDone && params.overview_id? && @overview_id != params.overview_id
|
||||
@overview_id = params.overview_id
|
||||
|
||||
@renderOverviewNavigator(@el)
|
||||
|
||||
# scroll to article if given
|
||||
scrollToPosition: (position, delay, article_id) =>
|
||||
scrollToDelay = =>
|
||||
|
@ -429,11 +434,7 @@ class App.TicketZoom extends App.Controller
|
|||
dir: App.i18n.dir()
|
||||
)
|
||||
|
||||
new App.TicketZoomOverviewNavigator(
|
||||
el: elLocal.find('.js-overviewNavigatorContainer')
|
||||
ticket_id: @ticket_id
|
||||
overview_id: @overview_id
|
||||
)
|
||||
@renderOverviewNavigator(elLocal)
|
||||
|
||||
new App.TicketZoomTitle(
|
||||
object_id: @ticket_id
|
||||
|
@ -1035,6 +1036,13 @@ class App.TicketZoom extends App.Controller
|
|||
article: {}
|
||||
App.TaskManager.update(@taskKey, { 'state': @localTaskData })
|
||||
|
||||
renderOverviewNavigator: (parentEl) ->
|
||||
new App.TicketZoomOverviewNavigator(
|
||||
el: parentEl.find('.js-overviewNavigatorContainer')
|
||||
ticket_id: @ticket_id
|
||||
overview_id: @overview_id
|
||||
)
|
||||
|
||||
class TicketZoomRouter extends App.ControllerPermanent
|
||||
requiredPermission: ['ticket.agent', 'ticket.customer']
|
||||
constructor: (params) ->
|
||||
|
|
|
@ -1094,6 +1094,7 @@ RSpec.describe 'Ticket zoom', type: :system do
|
|||
end
|
||||
end
|
||||
|
||||
<<<<<<< HEAD
|
||||
# https://github.com/zammad/zammad/issues/3260
|
||||
describe 'next in overview macro changes URL', authenticated_as: :authenticate do
|
||||
let(:ticket_a) { create(:ticket, title: 'ticket a', group: Group.first) }
|
||||
|
@ -1167,4 +1168,39 @@ RSpec.describe 'Ticket zoom', type: :system do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
# https://github.com/zammad/zammad/issues/3267
|
||||
describe 'previous/next buttons are added when open ticket is opened from overview' do
|
||||
let(:ticket_a) { create(:ticket, title: 'ticket a', group: Group.first) }
|
||||
let(:ticket_b) { create(:ticket, title: 'ticket b', group: Group.first) }
|
||||
|
||||
# prepare an opened ticket and go to overview
|
||||
before do
|
||||
ticket_a && ticket_b
|
||||
|
||||
visit "ticket/zoom/#{ticket_a.id}"
|
||||
|
||||
await_empty_ajax_queue
|
||||
|
||||
visit 'ticket/view/all_unassigned'
|
||||
end
|
||||
|
||||
it 'adds previous/next buttons to existing ticket' do
|
||||
within :active_content do
|
||||
click_on ticket_a.title
|
||||
|
||||
expect(page).to have_css('.pagination-counter')
|
||||
end
|
||||
end
|
||||
|
||||
it 'keeps previous/next buttons when navigating to overview ticket from elsewhere' do
|
||||
within :active_content do
|
||||
click_on ticket_a.title
|
||||
visit 'dashboard'
|
||||
visit "ticket/zoom/#{ticket_a.id}"
|
||||
|
||||
expect(page).to have_css('.pagination-counter')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue