Skip to content

Commit

Permalink
Merge pull request #635 from bitzesty/staging-los
Browse files Browse the repository at this point in the history
[STAGING] - allow admins to remove letters of support
  • Loading branch information
TheDancingClown authored Dec 4, 2023
2 parents 671e99a + 06f9dc1 commit eddcf2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/policies/support_letter_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ class SupportLetterPolicy < ApplicationPolicy
def show?
true
end

def can_remove?
admin?
end
end
3 changes: 1 addition & 2 deletions app/views/qae_form/_supporter_fields.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,5 @@ li.js-add-example class="#{'read-only js-support-letter-received' if persisted}"
- url = users_form_answer_support_letter_path(form_answer_id: @form_answer.id, id: supporter["support_letter_id"])
- else
- url = "#"

- if submission_deadline.trigger_at >= Time.zone.now
- if current_user || policy(:support_letter).can_remove?
= link_to "Remove", url, class: "govuk-button govuk-button--warning remove-supporter remove-link js-remove-link", data: { url: url }, 'aria-label' => "Delete support letter from #{supporter["first_name"]} #{supporter["last_name"]}"

0 comments on commit eddcf2b

Please sign in to comment.