Skip to content

Commit

Permalink
Merge pull request #3919 from alphagov/remove-important-board-member-…
Browse files Browse the repository at this point in the history
…constraint

Remove "important board members" image constraint
  • Loading branch information
ChrisBAshton authored Jan 2, 2025
2 parents f309fad + 85d6ac8 commit c81a689
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 115 deletions.
4 changes: 0 additions & 4 deletions app/models/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,6 @@ def all_roles
links.fetch("ordered_roles", [])
end

def important_board_member_count
details["important_board_members"]
end

def social_media_links
details["social_media_links"]
end
Expand Down
19 changes: 1 addition & 18 deletions app/presenters/organisations/people_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def has_people?
end

def all_people
all_people = @org.all_people.map do |person_type, people|
@org.all_people.map do |person_type, people|
{
type: person_type,
title: I18n.t("organisations.people.#{person_type}"),
Expand All @@ -23,29 +23,12 @@ def all_people
people: people.map { |person| formatted_person_data(person, person_type) },
}
end

images_for_important_board_members(all_people)
end

private

attr_reader :allowed_role_content_ids

def images_for_important_board_members(people)
people.map do |people_group|
if people_group[:type].eql?(:board_members)
people_group[:people].map.with_index(1) do |person, i|
if @org.important_board_member_count && i > @org.important_board_member_count
person.delete(:image_src)
person.delete(:image_alt)
end
end
end

people_group
end
end

def is_person_ministerial?(type)
type.eql?(:ministers)
end
Expand Down
30 changes: 0 additions & 30 deletions spec/presenters/organisations/people_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,36 +180,6 @@
expect(people_presenter.all_people.third[:people][1][:description]).to eq(expected)
end

it "does not show images for non-important board members" do
non_important_board_members = presenter_from_organisation_hash(organisation_with_non_important_board_members)

expected_important = {
brand: "attorney-generals-office",
href: "/government/people/jeremy-heywood",
description: "Cabinet Secretary",
metadata: "Unpaid",
heading_text: "Sir Jeremy Heywood",
lang: "en",
heading_level: 0,
extra_details_no_indent: true,
image_src: "/photo/jeremy-heywood",
}

expected_non_important = {
brand: "attorney-generals-office",
href: "/government/people/john-manzoni",
description: "Chief Executive of the Civil Service",
metadata: nil,
heading_text: "John Manzoni",
lang: "en",
heading_level: 0,
extra_details_no_indent: true,
}

expect(non_important_board_members.all_people.third[:people][0]).to eq(expected_important)
expect(non_important_board_members.all_people.third[:people][1]).to eq(expected_non_important)
end

it "fetches image" do
expect(people_presenter.all_people.third[:people][0][:image_src]).to eq("/photo/jeremy-heywood")
end
Expand Down
63 changes: 0 additions & 63 deletions spec/support/organisation_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,69 +350,6 @@ def organisation_with_board_members
}.with_indifferent_access
end

def organisation_with_non_important_board_members
{
title: "Attorney General's Office",
base_path: "/government/organisations/attorney-generals-office",
details: {
brand: "attorney-generals-office",
organisation_govuk_status: {
status: "live",
},
important_board_members: 1,
},
links: {
ordered_roles: [
{ content_id: "264a1f0e-6e0a-479b-83d4-2660afe36339" },
{ content_id: "61a62a60-df26-4454-81da-0594f0d74d76" },
],
ordered_board_members: [
{
title: "Sir Jeremy Heywood",
locale: "en",
base_path: "/government/people/jeremy-heywood",
details: {
image: {
url: "/photo/jeremy-heywood",
alt_text: "Sir Jeremy Heywood",
},
},
links: {
role_appointments: [
current_role_appointment(
content_id: "264a1f0e-6e0a-479b-83d4-2660afe36339",
title: "Cabinet Secretary",
document_type: "board_member_role",
payment_type: "Unpaid",
),
],
},
},
{
title: "John Manzoni",
locale: "en",
base_path: "/government/people/john-manzoni",
details: {
image: {
url: "/photo/john-manzoni",
alt_text: "John Manzoni",
},
},
links: {
role_appointments: [
current_role_appointment(
content_id: "61a62a60-df26-4454-81da-0594f0d74d76",
title: "Chief Executive of the Civil Service",
document_type: "board_member_role",
),
],
},
},
],
},
}.with_indifferent_access
end

def organisation_with_no_documents
{
title: "Org with No Docs",
Expand Down

0 comments on commit c81a689

Please sign in to comment.