OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix wrong delivery response displayed on click
Christophe Bliard32914911a139
diff --git a/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response/show.erb b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response/show.erbindex 61960b7f165..5f63fe747f6 100644--- a/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response/show.erb+++ b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response/show.erb@@ -1,8 +1,9 @@<sectiondata-augmented-model-wrapper+ data-activation-selector=".log-response-<%= id %>-modal--activation-link"data-modal-class-name="webhooks--response-body-modal">- <a class="modal-delivery-element--activation-link" title="<%= title %>">+ <a class="log-response-<%= id %>-modal--activation-link" title="<%= title %>"><%= op_icon('icon-info1') %><%= t(:button_show) %></a>diff --git a/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response_cell.rb b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response_cell.rbindex 9a42d2fd415..97546358696 100644--- a/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response_cell.rb+++ b/modules/webhooks/app/cells/webhooks/outgoing/deliveries/response_cell.rb@@ -4,6 +4,7 @@ module ::Webhooksclass ResponseCell < RailsCellview_paths << ::OpenProject::Webhooks::Engine.root.join("app/cells")+ property :idproperty :response_headersproperty :response_bodydiff --git a/modules/webhooks/spec/features/manage_webhooks_spec.rb b/modules/webhooks/spec/features/manage_webhooks_spec.rbindex 84e95679b8c..3053c608693 100644--- a/modules/webhooks/spec/features/manage_webhooks_spec.rb+++ b/modules/webhooks/spec/features/manage_webhooks_spec.rb@@ -6,7 +6,7 @@ describe 'Manage webhooks through UI', type: :feature, js: true doendcontext 'as regular user' do- let(:user) { create :user }+ let(:user) { create(:user) }it 'forbids accessing the webhooks management view' dovisit admin_outgoing_webhooks_path@@ -15,8 +15,8 @@ describe 'Manage webhooks through UI', type: :feature, js: true doendcontext 'as admin' do- let(:user) { create :admin }- let!(:project) { create :project }+ let(:user) { create(:admin) }+ let!(:project) { create(:project) }it 'allows the management flow' dovisit admin_outgoing_webhooks_path@@ -82,8 +82,8 @@ describe 'Manage webhooks through UI', type: :feature, js: true doendcontext 'with existing webhook' do- let!(:webhook) { create :webhook, name: 'testing' }- let!(:log) { create :webhook_log, response_headers: { test: :foo }, webhook: }+ let!(:webhook) { create(:webhook, name: 'testing') }+ let!(:log) { create(:webhook_log, response_headers: { test: :foo }, webhook:) }it 'shows the delivery' dovisit admin_outgoing_webhooks_path@@ -103,6 +103,32 @@ describe 'Manage webhooks through UI', type: :feature, js: true doexpect(page).to have_selector('.webhooks--response-body', text: log.response_body)endend++ context 'with multiple logs' do+ let!(:log2) { create(:webhook_log, response_body: 'This is the second log', webhook:) }+ let!(:log3) { create(:webhook_log, response_body: 'This is the third log', webhook:) }++ it 'shows the response of the log being clicked' do+ visit admin_outgoing_webhook_path(webhook)++ # Open modal+ SeleniumHubWaiter.wait++ all('tbody tr').each do |row_element|+ matching_log = nil+ within(row_element) do+ id = find('td.id').text.to_i+ matching_log = [log, log2, log3].find { |l| l.id == id }+ find('td.response_body a', text: 'Show').click+ end++ page.within('.spot-modal') do+ expect(page).to have_selector('.webhooks--response-body', text: matching_log.response_body)+ click_button('Close')+ end+ end+ end+ endendendend