Skip to content

Commit

Permalink
Merge pull request #13961 from ncounter/fix-spec-tests
Browse files Browse the repository at this point in the history
Clarify request staging information
  • Loading branch information
hennevogel committed Mar 30, 2023
2 parents 01044e2 + 9ca6422 commit 59e2235
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
16 changes: 9 additions & 7 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,15 @@ def staging_status(request, target_project)
return nil unless (staging_review = request.reviews.staging(target_project).last)

if staging_review.for_project?
{ name: staging_review.project.name[target_project.name.length + 1..],
title: "staged in #{staging_review.project}",
url: staging_workflow_staging_project_path(target_project.name, staging_review.project.name) }
elsif staging_review.for_group?
{ name: staging_review.accepted? ? 'Staged' : 'Unstaged',
title: 'submitted against a staging project',
url: staging_workflow_path(@bs_request.target_project_name) }
staging_project = {
name: staging_review.project.name[target_project.name.length + 1..],
url: staging_workflow_staging_project_path(target_project.name, staging_review.project.name)
}
end

{
staging_project: staging_project,
target_project_staging_url: staging_workflow_path(request.target_project_name)
}
end
end
14 changes: 10 additions & 4 deletions src/api/app/views/webui/request/beta_show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@
= link_to "##{supersed['number']}", number: supersed['number']
-# staging statement
- if @staging_status
- staging_project = @staging_status[:staging_project]
%li
%strong Staged
in
%mark.text-light.bg-staging.text-nowrap.text-decoration-underline
= link_to @staging_status[:title], @staging_status[:url]
- if staging_project
%mark.text-light.bg-staging.text-nowrap.text Staged
in
= link_to staging_project[:name], staging_project[:url]
- else
%strong Waiting
for a
%mark.text-light.bg-staging.text-nowrap.text-decoration-underline
= link_to 'staging project', @staging_status[:target_project_staging_url]
-# auto-accept statement
- if @bs_request.accept_at.present?
%li
Expand Down
2 changes: 1 addition & 1 deletion src/api/spec/features/webui/requests/submissions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
expect(page).to have_text('Select Action')
expect(page).to have_text('Next')
expect(page).to have_text("(of #{bs_request.bs_request_actions.count})")
expect(page).to have_text('Staged in')
expect(page).to have_css('.bg-staging')
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions src/api/spec/features/webui/requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@
Flipper.enable(:request_show_redesign)
end

it 'does not set badge for submit request' do
it 'does not set stage information for submit request' do
login submitter
visit request_show_path(bs_request)
click_on('Add Reviewer')
Expand All @@ -395,7 +395,8 @@
fill_in 'Project', with: staging_project.name
click_button('Accept')
end
expect(page).not_to have_css('.badge-staging')
expect(page).not_to have_text('Staged in')
expect(page).not_to have_css('.bg-staging')
end
end

Expand Down

0 comments on commit 59e2235

Please sign in to comment.