Browse Source

feat: sort dpo names in alphabetical order (#1708)

pull/1709/head v0.3.30
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
8e81d03051
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/components/data_protection_confirmation_banner_component.rb
  2. 2
      spec/components/data_protection_confirmation_banner_component_spec.rb

2
app/components/data_protection_confirmation_banner_component.rb

@ -22,7 +22,7 @@ class DataProtectionConfirmationBannerComponent < ViewComponent::Base
def data_protection_officers_text
if org_or_user_org.data_protection_officers.any?
"You can ask: #{org_or_user_org.data_protection_officers.map(&:name).join(', ')}"
"You can ask: #{org_or_user_org.data_protection_officers.map(&:name).sort_by(&:downcase).join(', ')}"
end
end

2
spec/components/data_protection_confirmation_banner_component_spec.rb

@ -31,7 +31,7 @@ RSpec.describe DataProtectionConfirmationBannerComponent, type: :component do
create(:user, organisation:, is_dpo: true, name: "Test McTest")
end
it "returns the correct text" do
it "returns the correct list of names, in alphabetical order)" do
expect(component.data_protection_officers_text).to eq("You can ask: Danny Rojas, Test McTest")
end
end

Loading…
Cancel
Save