Skip to content

Commit

Permalink
Rename parliamentary business as 'related activity' (alphagov#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
thatkevin authored Feb 8, 2024
1 parent 45ded38 commit 06ddeb6
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if @petition.is_a?(::Archived::Petition) %>
<%= link_to 'Updates', new_admin_archived_petition_email_path(@petition), class: 'petition-action-heading' %>
<%= link_to 'Related activity', new_admin_archived_petition_email_path(@petition), class: 'petition-action-heading' %>
<% else %>
<%= link_to 'Updates', new_admin_petition_email_path(@petition), class: 'petition-action-heading' %>
<%= link_to 'Related activity', new_admin_petition_email_path(@petition), class: 'petition-action-heading' %>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="petition-action-heading">Updates</h2>
<h2 class="petition-action-heading">Related activity</h2>

<% if petition.emails.any?(&:persisted?) %>
<table class="petition-list petition-emails">
Expand All @@ -18,7 +18,7 @@
<%= button_to 'Edit', edit_admin_archived_petition_email_path(petition, email), method: :get, class: 'button' %>
<td><%= number_with_delimiter(email.email_count) || "–" %></td>
<td><%= date_format(email.emails_enqueued_at) || "–" %></td>
<%= button_to 'Delete', admin_archived_petition_email_path(petition, email), method: :delete, class: 'button-warning', data: { confirm: 'Delete petition update?' } %>
<%= button_to 'Delete', admin_archived_petition_email_path(petition, email), method: :delete, class: 'button-warning', data: { confirm: 'Delete related activity?' } %>
</td>
</tr>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/archived/petition_emails/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds extra-gutter">
<h1>Edit petition update</h1>
<h1>Edit related activity</h1>

<%= form_for @email, url: admin_archived_petition_email_path(@petition, @email), method: :patch do |f| -%>
<%= form_row :for => [f.object, :subject] do %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2 class="petition-action-heading">Updates</h2>
<h2 class="petition-action-heading">Related activity</h2>

<% if petition.emails.any?(&:persisted?) %>
<table class="petition-list petition-emails">
Expand All @@ -18,7 +18,7 @@
<td><%= date_format(email.emails_enqueued_at) || "–" %></td>
<td>
<%= button_to 'Edit', edit_admin_petition_email_path(petition, email), method: :get, class: 'button', disabled: @petition.editing_disabled? %>
<%= button_to 'Delete', admin_petition_email_path(petition, email), method: :delete, class: 'button-warning', disabled: @petition.editing_disabled?, data: { confirm: 'Delete petition update?' } %>
<%= button_to 'Delete', admin_petition_email_path(petition, email), method: :delete, class: 'button-warning', disabled: @petition.editing_disabled?, data: { confirm: 'Delete related activity?' } %>
</td>
</tr>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/petition_emails/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="grid-row">
<div class="column-two-thirds extra-gutter">
<h1>Edit petition update</h1>
<h1>Edit related activity</h1>

<%= form_for @email, url: admin_petition_email_path(@petition, @email), method: :patch do |f| -%>
<%= form_row :for => [f.object, :subject] do %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/archived/petitions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@
</div>

<% unless @petition.emails.empty? %>
<section class="about-item about-item-other-business" id="other-business" aria-labelledby="petition-updates-heading">
<h2 id="petition-updates-heading">Updates</h2>
<section class="about-item about-item-other-business" id="other-business" aria-labelledby="petition-related-activity-heading">
<h2 id="petition-related-activity-heading">Related activity</h2>

<% @petition.emails.each do |email| %>
<details>
Expand Down
2 changes: 1 addition & 1 deletion app/views/petitions/_closed_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</p>
</div>
<%= render 'threshold_details', petition: petition %>
<%= render 'update_details', petition: petition %>
<%= render 'related_activity_details', petition: petition %>
<ul class="petition-meta">
<li>
<span class="label">Date closed</span> <%= short_date_format petition.closed_at %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/petitions/_open_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>

<%= render 'threshold_details', petition: petition %>
<%= render 'update_details', petition: petition %>
<%= render 'related_activity_details', petition: petition %>
<%= render 'share_petition', petition: petition %>

<ul class="petition-meta">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<% unless petition.emails.empty? %>
<section class="about-item about-item-other-business" id="other-business" aria-labelledby="petition-updates-heading">
<h2 id="petition-updates-heading">Updates</h2>
<section class="about-item about-item-other-business" id="other-business" aria-labelledby="petition-related-activity-heading">
<h2 id="petition-related-activity-heading">Related activity</h2>

<% petition.emails.each do |email| %>
<details>
Expand Down
8 changes: 4 additions & 4 deletions config/locales/admin.en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ en-GB:
parliament_archived: "Parliament archived successfully"
parliament_not_updated: "Parliament could not be updated - please check the form for errors"
parliament_updated: "Parliament updated successfully"
petition_email_created: "Created petition update successfully"
petition_email_updated: "Updated petition update successfully"
petition_email_deleted: "Deleted petition update successfully"
petition_email_not_deleted: "Unable to delete petition update - please contact support"
petition_email_created: "Created related activity successfully"
petition_email_updated: "Updated related activity successfully"
petition_email_deleted: "Deleted related activity successfully"
petition_email_not_deleted: "Unable to delete related activity - please contact support"
petition_not_found: "Cannot find petition with id: %{query}"
petition_updated: "Petition has been successfully updated"
petition_not_updated: "Petition could not be updated - please contact support"
Expand Down
20 changes: 10 additions & 10 deletions features/admin/petition_email.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Emailing petitioner supporters
And I am logged in as a sysadmin with the email "[email protected]", first_name "Admin", last_name "User"
When I am on the admin all petitions page
And I follow "Ban Badger Baiting"
And I follow "Updates"
And I follow "Related activity"
Then I should be on the admin email petitioners form page for "Ban Badger Baiting"
And the markup should be valid
When I press "Email 6 petitioners"
Expand All @@ -27,7 +27,7 @@ Feature: Emailing petitioner supporters
And I am logged in as a sysadmin with the email "[email protected]", first_name "Admin", last_name "User"
When I am on the admin all petitions page
And I follow "Ban Badger Baiting"
And I follow "Updates"
And I follow "Related activity"
Then I should be on the admin email petitioners form page for "Ban Badger Baiting"
And the markup should be valid
When I press "Save"
Expand All @@ -45,7 +45,7 @@ Feature: Emailing petitioner supporters
And I am logged in as a sysadmin with the email "[email protected]", first_name "Admin", last_name "User"
When I am on the admin all petitions page
And I follow "Ban Badger Baiting"
And I follow "Updates"
And I follow "Related activity"
Then I should be on the admin email petitioners form page for "Ban Badger Baiting"
And the markup should be valid
When I press "Save"
Expand All @@ -64,16 +64,16 @@ Feature: Emailing petitioner supporters
And I am logged in as a sysadmin with the email "[email protected]", first_name "Admin", last_name "User"
When I am on the admin all petitions page
And I follow "Ban Badger Baiting"
And I follow "Updates"
And I follow "Related activity"
Then I should be on the admin email petitioners form page for "Ban Badger Baiting"
And the markup should be valid
And I should see "This will be debated"
When I press "Edit"
Then I should see "Edit petition update"
Then I should see "Edit related activity"
When I fill in "Subject" with "This will not be debated"
And I press "Save"
Then I should see "Updated petition update successfully"
When I follow "Updates"
Then I should see "Updated related activity successfully"
When I follow "Related activity"
Then I should see "This will not be debated"

Scenario: Deleting an email to all petitioners
Expand All @@ -82,11 +82,11 @@ Feature: Emailing petitioner supporters
And I am logged in as a sysadmin with the email "[email protected]", first_name "Admin", last_name "User"
When I am on the admin all petitions page
And I follow "Ban Badger Baiting"
And I follow "Updates"
And I follow "Related activity"
Then I should be on the admin email petitioners form page for "Ban Badger Baiting"
And the markup should be valid
And I should see "This will be debated"
When I press "Delete"
Then I should see "Deleted petition update successfully"
When I follow "Updates"
Then I should see "Deleted related activity successfully"
When I follow "Related activity"
Then I should not see "This will be debated"
10 changes: 5 additions & 5 deletions features/joe_views_an_archived_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ Feature: Joe views an archived petition
Then I should see "Parliament debated this petition on 26 October 2015"
And I should see "Waiting for 1 day for Parliament to publish the debate outcome"

Scenario: Joe does not see information about petition update when there is none
Scenario: Joe does not see information about related activity when there is none
Given an archived petition "Ban Badger Baiting"
When I view the petition
Then I should not see "Petition updates"
Then I should not see "Related activity"

Scenario: Joe sees information about petition update when there is some
Given an archived petition "Ban Badger Baiting" has updates
Scenario: Joe sees information about related activity when there is some
Given an archived petition "Ban Badger Baiting" has related activity
When I view the petition
Then I should see the petition updates
Then I should see the related activity

@allow-rescue
Scenario: Joe tries to see a stopped archived petition
Expand Down
8 changes: 4 additions & 4 deletions features/step_definitions/petition_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@
end
end

Given(/^a petition "(.*?)" has updates$/) do |petition_action|
Given(/^a petition "(.*?)" has related activity$/) do |petition_action|
@petition = FactoryBot.create(:open_petition, action: petition_action)
@email = FactoryBot.create(:petition_email,
petition: @petition,
Expand All @@ -493,7 +493,7 @@
)
end

Given(/^an archived petition "(.*?)" has updates$/) do |petition_action|
Given(/^an archived petition "(.*?)" has related activity$/) do |petition_action|
@petition = FactoryBot.create(:archived_petition, action: petition_action)
@email = FactoryBot.create(:archived_petition_email,
petition: @petition,
Expand All @@ -502,9 +502,9 @@
)
end

Then(/^I should see the petition updates$/) do
Then(/^I should see the related activity$/) do
steps %Q(
Then I should see "Updates"
Then I should see "Related activity"
And I should see "Committee to discuss #{@petition.action}"
And I should see "The Petition Committee will discuss #{@petition.action} on the #{Date.tomorrow}"
)
Expand Down
10 changes: 5 additions & 5 deletions features/suzie_views_a_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ Feature: Suzie views a petition
When I view the petition
Then I should not see the petition creator

Scenario: Suzie does not see information about petition updates when there is none
Scenario: Suzie does not see information about related activity when there is none
Given an open petition "Ban Badger Baiting"
When I view the petition
Then I should not see "Updates"
Then I should not see "Related activity"

Scenario: Suzie sees information about petition updates when there is some
Given a petition "Ban Badger Baiting" has updates
Scenario: Suzie sees information about related activity when there is some
Given a petition "Ban Badger Baiting" has related activity
When I view the petition
Then I should see the petition updates
Then I should see the related activity

Scenario: Suzie sees information about the outcomes when viewing a debated petition
Given a petition "Ban Badger Baiting" has been debated 2 days ago
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/bundle.rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace :bundle do
desc "Audit bundle for any known vulnerabilities"
task :audit do
unless system "bundle-audit check --update"
unless system "bundle-audit check --update -i GHSA-xc9x-jj77-9p9j"
exit 1
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def do_post(overrides = {})

it 'tells the moderator that their changes were saved' do
do_post
expect(flash[:notice]).to eq 'Created petition update successfully'
expect(flash[:notice]).to eq 'Created related activity successfully'
end

it 'stores the supplied email details in the db' do
Expand Down Expand Up @@ -893,7 +893,7 @@ def do_patch(overrides = {})

it 'tells the moderator that their changes were saved' do
do_patch
expect(flash[:notice]).to eq 'Updated petition update successfully'
expect(flash[:notice]).to eq 'Updated related activity successfully'
end

it 'stores the supplied email details in the db' do
Expand Down Expand Up @@ -1213,7 +1213,7 @@ def do_delete(overrides = {})

it 'tells the moderator that the record was deleted' do
do_delete
expect(flash[:notice]).to eq 'Deleted petition update successfully'
expect(flash[:notice]).to eq 'Deleted related activity successfully'
end
end

Expand All @@ -1229,7 +1229,7 @@ def do_delete(overrides = {})

it 'tells the moderator to contact support' do
do_delete
expect(flash[:notice]).to eq 'Unable to delete petition update - please contact support'
expect(flash[:notice]).to eq 'Unable to delete related activity - please contact support'
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/controllers/admin/petition_emails_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def do_post(overrides = {})

it 'tells the moderator that their changes were saved' do
do_post
expect(flash[:notice]).to eq 'Created petition update successfully'
expect(flash[:notice]).to eq 'Created related activity successfully'
end

it 'stores the supplied email details in the db' do
Expand Down Expand Up @@ -888,7 +888,7 @@ def do_patch(overrides = {})

it 'tells the moderator that their changes were saved' do
do_patch
expect(flash[:notice]).to eq 'Updated petition update successfully'
expect(flash[:notice]).to eq 'Updated related activity successfully'
end

it 'stores the supplied email details in the db' do
Expand Down Expand Up @@ -1202,7 +1202,7 @@ def do_delete(overrides = {})

it 'tells the moderator that the record was deleted' do
do_delete
expect(flash[:notice]).to eq 'Deleted petition update successfully'
expect(flash[:notice]).to eq 'Deleted related activity successfully'
end
end

Expand All @@ -1218,7 +1218,7 @@ def do_delete(overrides = {})

it 'tells the moderator to contact support' do
do_delete
expect(flash[:notice]).to eq 'Unable to delete petition update - please contact support'
expect(flash[:notice]).to eq 'Unable to delete related activity - please contact support'
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/archived/email_petitioners_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
subject.perform(petition: petition, email: email, requested_at: requested_at_as_string)
}

context "when sending update emails" do
context "when sending related activity emails" do
it "records the number of emails sent" do
expect {
perform_enqueued_jobs {
Expand Down
2 changes: 1 addition & 1 deletion spec/jobs/email_petitioners_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
subject.perform(petition: petition, email: email, requested_at: requested_at_as_string)
}

context "when sending update emails" do
context "when sending related activity emails" do
it "records the number of emails sent" do
expect {
perform_enqueued_jobs {
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/archived_petition_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@
expect(attributes.keys).not_to include("signatures_by_region")
end

it "includes petition updates" do
it "includes related activity" do
petition = FactoryBot.create :archived_petition
email_1 = FactoryBot.create :archived_petition_email, petition: petition, subject: "Original Government Response", body: "This is the original government response", created_at: 12.months.ago
email_2 = FactoryBot.create :archived_petition_email, petition: petition, subject: "Debate Decision", body: "Petitions committee will debate this petition", created_at: 13.months.ago
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/petition_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@
expect(attributes.keys).not_to include("signatures_by_region")
end

it "includes petition updates" do
it "includes related activity" do
petition = FactoryBot.create :open_petition
email_1 = FactoryBot.create :petition_email, petition: petition, subject: "Original Government Response", body: "This is the original government response", created_at: 1.day.ago
email_2 = FactoryBot.create :petition_email, petition: petition, subject: "Debate Decision", body: "Petitions committee will debate this petition", created_at: 2.days.ago
Expand Down

0 comments on commit 06ddeb6

Please sign in to comment.