Render only displayed report options

This commit is contained in:
Maikel Linke
2018-04-26 20:18:13 +10:00
parent 742e9d2a5f
commit 36b5f0eea7

View File

@@ -309,10 +309,8 @@ Spree::Admin::ReportsController.class_eval do
:xero_invoices,
:packing
]
reports = all_reports.map { |report| [report, describe_report(report)] }.to_h
# Return only reports the user is authorized to view.
reports.select { |action| can? action, :report }
reports = all_reports.select { |action| can? action, :report }
reports.map { |report| [report, describe_report(report)] }.to_h
end
def describe_report(report)