Skip to content

Commit 6c8a325

Browse files
authored
Merge pull request #9765 from alphagov/remove-important-board-member-constraint
Remove "important board members" image constraint
2 parents 185ed86 + 0869d67 commit 6c8a325

File tree

14 files changed

+28
-138
lines changed

14 files changed

+28
-138
lines changed

app/components/admin/organisations/show/summary_list_component.rb

-10
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def rows
3535
topical_events_row,
3636
featured_links_position_row,
3737
featured_links_row,
38-
management_team_row,
3938
foi_exempt_row,
4039
analytics_identifier_row,
4140
]
@@ -224,15 +223,6 @@ def featured_links_row
224223
end
225224
end
226225

227-
def management_team_row
228-
return if organisation.important_board_members.blank?
229-
230-
{
231-
field: "Management team images on homepage",
232-
value: organisation.important_board_members,
233-
}
234-
end
235-
236226
def foi_exempt_row
237227
return unless organisation.foi_exempt
238228

app/controllers/admin/organisations_controller.rb

-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def organisation_params
107107
:public_meetings,
108108
:public_minutes,
109109
:regulatory_function,
110-
:important_board_members,
111110
:custom_jobs_url,
112111
:homepage_type,
113112
:political,

app/presenters/publishing_api/organisation_presenter.rb

-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ def details
9090
ordered_featured_links: featured_links,
9191
ordered_featured_documents: featured_documents(item, item.featured_documents_display_limit),
9292
ordered_promotional_features: promotional_features,
93-
important_board_members:,
9493
organisation_featuring_priority:,
9594
organisation_govuk_status:,
9695
organisation_type:,
@@ -335,10 +334,6 @@ def people_content_ids(role:)
335334
.map(&:content_id)
336335
end
337336

338-
def important_board_members
339-
item.important_board_members
340-
end
341-
342337
def organisation_featuring_priority
343338
item.homepage_type
344339
end

app/views/admin/organisations/_form.html.erb

-19
Original file line numberDiff line numberDiff line change
@@ -319,25 +319,6 @@
319319
</div>
320320
<% end %>
321321

322-
<div class="govuk-!-margin-top-6">
323-
<% if can?(:manage_important_board_members, @organisation) && @organisation.management_roles.any? %>
324-
<%= render "govuk_publishing_components/components/select", {
325-
name: "organisation[important_board_members]",
326-
id: "organisation_important_board_members",
327-
label: "Display management team images (required)",
328-
heading_size: "l",
329-
error_message: errors_for_input(@organisation.errors, :important_board_members),
330-
options: (1..@organisation.management_roles.count).map do |n|
331-
{
332-
text: n,
333-
value: n,
334-
selected: @organisation.important_board_members == n,
335-
}
336-
end,
337-
} %>
338-
<% end %>
339-
</div>
340-
341322
<div class="app-view-organisation__form__non-departmental-public-body-field js-view-organisation__form__non-departmental-public-body-fields <%= "app-view-organisation__form__non-departmental-public-body-fields--hidden" unless organisation.type&.non_departmental_public_body? %>">
342323
<%= render "govuk_publishing_components/components/fieldset", {
343324
legend_text: "Non-Departmental Public Body Information",

db/data_migration/20230518160200_reinstate_independent_agricultural_appeals_panel_organisation.rb

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ def recreate_organisation_and_dependencies
88
organisation_logo_type_id: 2,
99
analytics_identifier: "PB210",
1010
handles_fatalities: false,
11-
important_board_members: 1,
1211
default_news_organisation_image_data_id: nil,
1312
closed_at: nil,
1413
organisation_brand_colour_id: 7,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class RemoveImportantBoardMembersFromOrganisations < ActiveRecord::Migration[7.1]
2+
def change
3+
remove_column :organisations, :important_board_members, :integer
4+
end
5+
end

db/schema.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
# It's strongly recommended that you check this file into your version control system.
1212

13-
ActiveRecord::Schema[7.1].define(version: 2024_11_11_142527) do
13+
ActiveRecord::Schema[7.1].define(version: 2024_12_20_143730) do
1414
create_table "assets", charset: "utf8mb3", force: :cascade do |t|
1515
t.string "asset_manager_id", null: false
1616
t.string "variant", null: false
@@ -788,7 +788,6 @@
788788
t.integer "organisation_logo_type_id", default: 2
789789
t.string "analytics_identifier"
790790
t.boolean "handles_fatalities", default: false
791-
t.integer "important_board_members", default: 1
792791
t.datetime "closed_at", precision: nil
793792
t.integer "organisation_brand_colour_id"
794793
t.boolean "ocpa_regulated"

lib/whitehall/authority/rules/organisation_rules.rb

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ def can?(action)
88
actor.gds_admin? || actor_is_from_organisation_or_parent?(actor, subject)
99
when :manage_featured_links
1010
actor.gds_admin? || actor.gds_editor? || managing_editor_for_org?(actor, subject)
11-
when :manage_important_board_members
12-
actor.gds_admin? || actor.gds_editor? || managing_editor_for_org?(actor, subject) || departmental_editor_for_org?(actor, subject)
1311
else
1412
false
1513
end

test/components/admin/organisations/show/summary_list_component_test.rb

+22-24
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
2525

2626
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
2727

28-
assert_selector ".govuk-summary-list__row", count: 8
28+
assert_selector ".govuk-summary-list__row", count: 7
2929
assert_selector ".govuk-summary-list__row:nth-child(1) .govuk-summary-list__key", text: "Name"
3030
assert_selector ".govuk-summary-list__row:nth-child(1) .govuk-summary-list__value", text: organisation.name
3131
assert_selector ".govuk-summary-list__row:nth-child(2) .govuk-summary-list__key", text: "Logo formatted name"
@@ -38,18 +38,16 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
3838
assert_selector ".govuk-summary-list__row:nth-child(5) .govuk-summary-list__value", text: organisation.govuk_status.titleize
3939
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Featured link position"
4040
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: "News priority"
41-
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Management team images on homepage"
42-
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__value", text: organisation.important_board_members
43-
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__key", text: "Analytics identifier"
44-
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__value", text: organisation.analytics_identifier
41+
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Analytics identifier"
42+
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__value", text: organisation.analytics_identifier
4543
end
4644

4745
test "renders acronym_row if the organisation has an acronym" do
4846
organisation = build_stubbed(:ministerial_department, acronym: "ACRO")
4947

5048
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
5149

52-
assert_selector ".govuk-summary-list__row", count: 9
50+
assert_selector ".govuk-summary-list__row", count: 8
5351
assert_selector ".govuk-summary-list__row:nth-child(2) .govuk-summary-list__key", text: "Acronym"
5452
assert_selector ".govuk-summary-list__row:nth-child(2) .govuk-summary-list__value", text: organisation.acronym
5553
end
@@ -59,7 +57,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
5957

6058
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
6159

62-
assert_selector ".govuk-summary-list__row", count: 9
60+
assert_selector ".govuk-summary-list__row", count: 8
6361
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__key", text: "Brand colour"
6462
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__value", text: organisation.organisation_brand_colour.title
6563
end
@@ -70,7 +68,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
7068

7169
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
7270

73-
assert_selector ".govuk-summary-list__row", count: 9
71+
assert_selector ".govuk-summary-list__row", count: 8
7472
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__key", text: "Default news image"
7573
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__value img[src='#{news_image.file.url(:s300)}']"
7674
end
@@ -80,7 +78,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
8078

8179
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
8280

83-
assert_selector ".govuk-summary-list__row", count: 9
81+
assert_selector ".govuk-summary-list__row", count: 8
8482
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__key", text: "Organisation’s URL"
8583
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__value", text: "http://parrot.org"
8684
assert_selector ".govuk-summary-list__row:nth-child(4) .govuk-summary-list__actions a[href='#{organisation.url}']", text: /View/
@@ -91,7 +89,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
9189

9290
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
9391

94-
assert_selector ".govuk-summary-list__row", count: 9
92+
assert_selector ".govuk-summary-list__row", count: 8
9593
assert_selector ".govuk-summary-list__row:nth-child(5) .govuk-summary-list__key", text: "Accessible formats request email"
9694
assert_selector ".govuk-summary-list__row:nth-child(5) .govuk-summary-list__value", text: organisation.alternative_format_contact_email
9795
end
@@ -103,7 +101,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
103101

104102
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
105103

106-
assert_selector ".govuk-summary-list__row", count: 11
104+
assert_selector ".govuk-summary-list__row", count: 10
107105
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Reason for closure"
108106
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: organisation.govuk_closed_status
109107
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Organisation closed on"
@@ -121,7 +119,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
121119

122120
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
123121

124-
assert_selector ".govuk-summary-list__row", count: 12
122+
assert_selector ".govuk-summary-list__row", count: 11
125123
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__key", text: "Superseding organisation 1"
126124
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__value", text: superseding_organisation1.name
127125
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__actions a[href='#{superseding_organisation1.public_url}']", text: /View/
@@ -135,7 +133,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
135133

136134
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
137135

138-
assert_selector ".govuk-summary-list__row", count: 9
136+
assert_selector ".govuk-summary-list__row", count: 8
139137
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Organisation chart URL"
140138
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: organisation.organisation_chart_url
141139
end
@@ -145,7 +143,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
145143

146144
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
147145

148-
assert_selector ".govuk-summary-list__row", count: 9
146+
assert_selector ".govuk-summary-list__row", count: 8
149147
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Recruitment URL"
150148
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: organisation.custom_jobs_url
151149
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__actions a[href='#{organisation.custom_jobs_url}']", text: /View/
@@ -156,7 +154,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
156154

157155
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
158156

159-
assert_selector ".govuk-summary-list__row", count: 9
157+
assert_selector ".govuk-summary-list__row", count: 8
160158
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Publishes content associated with the current government"
161159
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: "Yes"
162160
end
@@ -168,7 +166,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
168166

169167
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
170168

171-
assert_selector ".govuk-summary-list__row", count: 9
169+
assert_selector ".govuk-summary-list__row", count: 8
172170
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Sponsoring organisation"
173171
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: parent_organisation.name
174172
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__actions a[href='#{parent_organisation.public_url}']", text: /View/
@@ -182,7 +180,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
182180

183181
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
184182

185-
assert_selector ".govuk-summary-list__row", count: 10
183+
assert_selector ".govuk-summary-list__row", count: 9
186184
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Sponsoring organisation 1"
187185
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: parent_organisation1.name
188186
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__actions a[href='#{parent_organisation1.public_url}']", text: /View/
@@ -198,7 +196,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
198196

199197
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
200198

201-
assert_selector ".govuk-summary-list__row", count: 9
199+
assert_selector ".govuk-summary-list__row", count: 8
202200
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Topical event"
203201
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: topical_event.name
204202
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__actions a[href='#{topical_event.public_url}']", text: /View/
@@ -212,7 +210,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
212210

213211
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
214212

215-
assert_selector ".govuk-summary-list__row", count: 10
213+
assert_selector ".govuk-summary-list__row", count: 9
216214
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__key", text: "Topical event 1"
217215
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__value", text: topical_event1.name
218216
assert_selector ".govuk-summary-list__row:nth-child(6) .govuk-summary-list__actions a[href='#{topical_event1.public_url}']", text: /View/
@@ -228,7 +226,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
228226

229227
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
230228

231-
assert_selector ".govuk-summary-list__row", count: 9
229+
assert_selector ".govuk-summary-list__row", count: 8
232230
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Featured link"
233231
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__value", text: featured_link.title
234232
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__actions a[href='#{featured_link.url}']", text: /View/
@@ -242,7 +240,7 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
242240

243241
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
244242

245-
assert_selector ".govuk-summary-list__row", count: 10
243+
assert_selector ".govuk-summary-list__row", count: 9
246244
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Featured link 1"
247245
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__value", text: featured_link1.title
248246
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__actions a[href='#{featured_link1.url}']", text: /View/
@@ -256,8 +254,8 @@ class Admin::Organisations::Show::SummaryListComponentTest < ViewComponent::Test
256254

257255
render_inline(Admin::Organisations::Show::SummaryListComponent.new(organisation:))
258256

259-
assert_selector ".govuk-summary-list__row", count: 9
260-
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__key", text: "Exempt from Freedom of Information requests"
261-
assert_selector ".govuk-summary-list__row:nth-child(8) .govuk-summary-list__value", text: "Yes"
257+
assert_selector ".govuk-summary-list__row", count: 8
258+
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__key", text: "Exempt from Freedom of Information requests"
259+
assert_selector ".govuk-summary-list__row:nth-child(7) .govuk-summary-list__value", text: "Yes"
262260
end
263261
end

test/functional/admin/organisations_controller_test.rb

-38
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,6 @@ def example_organisation_attributes
9191
assert_match %r{logo.png}, Organisation.last.logo.file.filename
9292
end
9393

94-
test "POST create can set number of important board members" do
95-
post :create,
96-
params: {
97-
organisation: example_organisation_attributes
98-
.merge(important_board_members: 1),
99-
}
100-
101-
assert_equal 1, Organisation.last.important_board_members
102-
end
103-
10494
test "POST on :create with invalid data re-renders the new form" do
10595
attributes = example_organisation_attributes
10696

@@ -138,34 +128,6 @@ def example_organisation_attributes
138128
assert_equal organisation, assigns(:organisation)
139129
end
140130

141-
view_test "GET on :edit allows entry of important board members only data to Editors and above" do
142-
organisation = create(:organisation)
143-
junior_board_member_role = create(:board_member_role)
144-
senior_board_member_role = create(:board_member_role)
145-
146-
create(:organisation_role, organisation:, role: senior_board_member_role)
147-
create(:organisation_role, organisation:, role: junior_board_member_role)
148-
149-
managing_editor = create(:managing_editor, organisation:)
150-
departmental_editor = create(:departmental_editor, organisation:)
151-
world_editor = create(:world_editor, organisation:)
152-
153-
get :edit, params: { id: organisation }
154-
assert_select "select#organisation_important_board_members option", count: 2
155-
156-
login_as(departmental_editor)
157-
get :edit, params: { id: organisation }
158-
assert_select "select#organisation_important_board_members option", count: 2
159-
160-
login_as(managing_editor)
161-
get :edit, params: { id: organisation }
162-
assert_select "select#organisation_important_board_members option", count: 2
163-
164-
login_as(world_editor)
165-
get :edit, params: { id: organisation }
166-
assert_select "select#organisation_important_board_members option", count: 0
167-
end
168-
169131
view_test "GET :edit renders hidden id field for default news image" do
170132
organisation = create(:organisation, :with_default_news_image)
171133

test/unit/app/presenters/publishing_api/organisation_presenter_test.rb

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def govspeak_to_html(govspeak)
2525
analytics_identifier: "O123",
2626
parent_organisations: [parent_organisation],
2727
url: "https://www.gov.uk/oot",
28-
important_board_members: 5,
2928
default_news_image: news_image,
3029
)
3130
create(
@@ -75,7 +74,6 @@ def govspeak_to_html(govspeak)
7574
ordered_featured_links: [],
7675
ordered_featured_documents: [],
7776
ordered_promotional_features: [],
78-
important_board_members: 5,
7977
organisation_featuring_priority: "news",
8078
organisation_govuk_status: {
8179
status: "live",

0 commit comments

Comments
 (0)