From a8e864dcdcf5524ad3a5f189a6fc1ad05c379307 Mon Sep 17 00:00:00 2001 From: Louis Kirkham Date: Mon, 13 May 2024 16:34:36 +0100 Subject: [PATCH] Allows superadmins to manage addresses at any time https://app.asana.com/0/1200504523179343/1207294471438599/f Update CompanyDetailPolicy to allow superadmins to update at any time --- app/policies/company_detail_policy.rb | 4 +++- .../form_answers/company_details/_address_form.html.slim | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/policies/company_detail_policy.rb b/app/policies/company_detail_policy.rb index f79f88c7c3..9d9c917cef 100644 --- a/app/policies/company_detail_policy.rb +++ b/app/policies/company_detail_policy.rb @@ -8,6 +8,8 @@ def can_manage_company_name? end def can_manage_address? - admin? + if admin? + record.submitted_and_after_the_deadline? || subject.superadmin? + end end end diff --git a/app/views/admin/form_answers/company_details/_address_form.html.slim b/app/views/admin/form_answers/company_details/_address_form.html.slim index 9f4f2fe236..3c7ec7e03b 100644 --- a/app/views/admin/form_answers/company_details/_address_form.html.slim +++ b/app/views/admin/form_answers/company_details/_address_form.html.slim @@ -142,7 +142,7 @@ = @form_answer.document["website_url"] br - - if resource.submitted_and_after_the_deadline? && CompanyDetailPolicy.new(pundit_user, resource).can_manage_address? + - if CompanyDetailPolicy.new(pundit_user, resource).can_manage_address? = simple_form_for([namespace_name, resource], remote: true, authenticity_token: true, html: { data: { type: "html", inline_flash_target: "form" }, id: "address_form_admin_appraisal" }) do |f| @@ -259,7 +259,7 @@ = @form_answer.nominator_email br - - if resource.submitted_and_after_the_deadline? && CompanyDetailPolicy.new(pundit_user, resource).can_manage_address? + - if CompanyDetailPolicy.new(pundit_user, resource).can_manage_address? = simple_form_for([namespace_name, resource], remote: true, authenticity_token: true, html: { data: { type: "html", inline_flash_target: "form" }, id: "address_form_admin_appraisal" }) do |f|