mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Consolidate translations for hidden field
The string '< Hidden >' was agreed on as a good default, so we will use the hidden_field key. I also moved the definition in en.yml up to the more general area at the start of admin.reports section (before it was hidden between report-specific keys.
This commit is contained in:
@@ -24,9 +24,9 @@ module Orders
|
||||
end
|
||||
|
||||
def mask_customer_names
|
||||
order.bill_address&.assign_attributes(firstname: I18n.t('admin.reports.hidden'),
|
||||
order.bill_address&.assign_attributes(firstname: I18n.t('admin.reports.hidden_field'),
|
||||
lastname: "")
|
||||
order.ship_address&.assign_attributes(firstname: I18n.t('admin.reports.hidden'),
|
||||
order.ship_address&.assign_attributes(firstname: I18n.t('admin.reports.hidden_field'),
|
||||
lastname: "")
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ module Orders
|
||||
def mask_contact_data
|
||||
order.bill_address&.assign_attributes(phone: "")
|
||||
order.ship_address&.assign_attributes(phone: "")
|
||||
order.assign_attributes(email: I18n.t('admin.reports.hidden'))
|
||||
order.assign_attributes(email: I18n.t('admin.reports.hidden_field'))
|
||||
end
|
||||
|
||||
def mask_address
|
||||
|
||||
@@ -1765,7 +1765,7 @@ en:
|
||||
not_visible: "%{enterprise} is not visible and so cannot be found on the map or in searches"
|
||||
reports:
|
||||
deprecated: "This report is deprecated and will be removed in a future release."
|
||||
hidden: HIDDEN
|
||||
hidden_field: "< Hidden >"
|
||||
unitsize: UNITSIZE
|
||||
total: TOTAL
|
||||
total_items: TOTAL ITEMS
|
||||
@@ -1843,7 +1843,6 @@ en:
|
||||
no_report_type: "Please specify a report type"
|
||||
report_not_found: "Report not found"
|
||||
missing_ransack_params: "Please supply Ransack search params in the request"
|
||||
hidden_field: "< Hidden >"
|
||||
summary_row:
|
||||
total: "TOTAL"
|
||||
table:
|
||||
|
||||
@@ -133,7 +133,7 @@ module Reporting
|
||||
|
||||
it "shows line items supplied by my producers, with names hidden" do
|
||||
expect(subject.table_items).to eq([li2])
|
||||
expect(subject.table_items.first.order.bill_address.firstname).to eq("HIDDEN")
|
||||
expect(subject.table_items.first.order.bill_address.firstname).to eq("< Hidden >")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ RSpec.describe Reporting::LineItems do
|
||||
|
||||
it 'returns masked data' do
|
||||
line_items = reports_line_items.list
|
||||
expect(line_items.first.order.email).to eq('HIDDEN')
|
||||
expect(line_items.first.order.email).to eq("< Hidden >")
|
||||
end
|
||||
|
||||
context "when filtering by product" do
|
||||
|
||||
@@ -120,7 +120,7 @@ RSpec.describe Reporting::Reports::OrdersAndDistributors::Base do
|
||||
it "shows line items supplied by my producers, with contact details hidden" do
|
||||
expect(row).not_to include("FirstName LastName")
|
||||
expect(row).not_to include("123-456", "City", order.email)
|
||||
expect(row[2..5]).to eq ["HIDDEN", "HIDDEN", "", ""]
|
||||
expect(row[2..5]).to eq ["< Hidden >", "< Hidden >", "", ""]
|
||||
end
|
||||
|
||||
context "where the distributor allows suppliers to see customer names" do
|
||||
@@ -131,7 +131,7 @@ RSpec.describe Reporting::Reports::OrdersAndDistributors::Base do
|
||||
it "shows line items supplied by my producers, with only contact names shown" do
|
||||
expect(row).to include("FirstName LastName")
|
||||
expect(row).not_to include("123-456", "City", order.email)
|
||||
expect(row[2..5]).to eq [bill_address.full_name, "HIDDEN", "", ""]
|
||||
expect(row[2..5]).to eq [bill_address.full_name, "< Hidden >", "", ""]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -142,7 +142,7 @@ RSpec.describe Reporting::Reports::OrdersAndDistributors::Base do
|
||||
|
||||
it "shows line items supplied by my producers, with only contact details shown" do
|
||||
expect(row).not_to include("FirstName LastName", "City")
|
||||
expect(row[2..5]).to eq ["HIDDEN", order.email, "123-456", ""]
|
||||
expect(row[2..5]).to eq ["< Hidden >", order.email, "123-456", ""]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,11 +12,11 @@ RSpec.describe Orders::MaskDataService do
|
||||
described_class.new(order).call
|
||||
|
||||
expect(order.bill_address.attributes).to include(
|
||||
'firstname' => 'HIDDEN',
|
||||
'firstname' => "< Hidden >",
|
||||
'lastname' => ''
|
||||
)
|
||||
expect(order.ship_address.attributes).to include(
|
||||
'firstname' => 'HIDDEN',
|
||||
'firstname' => "< Hidden >",
|
||||
'lastname' => ''
|
||||
)
|
||||
end
|
||||
@@ -29,7 +29,7 @@ RSpec.describe Orders::MaskDataService do
|
||||
expect(order.bill_address.attributes).to include('phone' => '')
|
||||
expect(order.ship_address.attributes).to include('phone' => '')
|
||||
|
||||
expect(order.email).to eq('HIDDEN')
|
||||
expect(order.email).to eq("< Hidden >")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,11 +65,11 @@ RSpec.describe Orders::MaskDataService do
|
||||
described_class.new(order).call
|
||||
|
||||
expect(order.bill_address.attributes).not_to include(
|
||||
firstname: 'HIDDEN',
|
||||
firstname: "< Hidden >",
|
||||
lastname: ''
|
||||
)
|
||||
expect(order.ship_address.attributes).not_to include(
|
||||
firstname: 'HIDDEN',
|
||||
firstname: "< Hidden >",
|
||||
lastname: ''
|
||||
)
|
||||
end
|
||||
@@ -95,7 +95,7 @@ RSpec.describe Orders::MaskDataService do
|
||||
expect(order.bill_address.attributes).not_to include('phone' => '')
|
||||
expect(order.ship_address.attributes).not_to include('phone' => '')
|
||||
|
||||
expect(order.email).not_to eq('HIDDEN')
|
||||
expect(order.email).not_to eq("< Hidden >")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user