Browse Source

Use data_protection_confirmed? method

pull/1684/head
Jack S 3 years ago
parent
commit
54584a5949
  1. 2
      app/components/create_log_actions_component.rb
  2. 2
      app/controllers/organisations_controller.rb
  3. 4
      app/helpers/data_sharing_agreement_helper.rb
  4. 2
      app/models/log.rb
  5. 2
      app/views/logs/_create_for_org_actions.html.erb
  6. 2
      app/views/organisations/data_sharing_agreement.html.erb

2
app/components/create_log_actions_component.rb

@ -16,7 +16,7 @@ class CreateLogActionsComponent < ViewComponent::Base
return true unless FeatureToggle.new_data_protection_confirmation?
return true if user.support?
user.organisation.data_protection_confirmation&.confirmed?
user.organisation.data_protection_confirmed?
end
def create_button_href

2
app/controllers/organisations_controller.rb

@ -165,7 +165,7 @@ class OrganisationsController < ApplicationController
def confirm_data_sharing_agreement
return render_not_found unless FeatureToggle.new_data_protection_confirmation?
return render_not_found unless current_user.is_dpo?
return render_not_found if @organisation.data_protection_confirmation&.confirmed?
return render_not_found if @organisation.data_protection_confirmed?
if @organisation.data_protection_confirmation
@organisation.data_protection_confirmation.update!(

4
app/helpers/data_sharing_agreement_helper.rb

@ -68,7 +68,7 @@ module DataSharingAgreementHelper
private
def data_sharing_agreement_first_line(organisation:, user:)
return "Not accepted" unless organisation.data_protection_confirmation&.confirmed?
return "Not accepted" unless organisation.data_protection_confirmed?
if user.support?
"Accepted #{organisation.data_protection_confirmation.created_at.strftime('%d/%m/%Y')}"
@ -78,7 +78,7 @@ private
end
def data_sharing_agreement_second_line(organisation:, user:)
if organisation.data_protection_confirmation&.confirmed?
if organisation.data_protection_confirmed?
organisation.data_protection_confirmation.data_protection_officer.name if user.support?
else
"Data protection officer must sign" unless user.is_dpo?

2
app/models/log.rb

@ -181,7 +181,7 @@ private
def verify_dsa_signed
return unless FeatureToggle.new_data_protection_confirmation?
return unless owning_organisation
return if owning_organisation.data_protection_confirmation&.confirmed?
return if owning_organisation.data_protection_confirmed?
errors.add :owning_organisation, I18n.t("validations.organisation.data_sharing_agreement_not_signed")
end

2
app/views/logs/_create_for_org_actions.html.erb

@ -1,5 +1,5 @@
<div class="govuk-button-group app-filter-toggle">
<% if !FeatureToggle.new_data_protection_confirmation? || @organisation.data_protection_confirmation&.confirmed? %>
<% if !FeatureToggle.new_data_protection_confirmation? || @organisation.data_protection_confirmed? %>
<% if current_page?(controller: 'organisations', action: 'lettings_logs') %>
<%= govuk_button_to "Create a new lettings log for this organisation", lettings_logs_path(lettings_log: { owning_organisation_id: @organisation.id }, method: :post) %>
<% end %>

2
app/views/organisations/data_sharing_agreement.html.erb

@ -134,7 +134,7 @@
<li>Title: Deputy Director</li>
</ul>
<% if current_user.is_dpo? && !(@organisation.data_protection_confirmation&.confirmed?) %>
<% if current_user.is_dpo? && !(@organisation.data_protection_confirmed?) %>
<div class="govuk-button-group govuk-!-margin-top-9">
<%= govuk_button_to("Accept this agreement", data_sharing_agreement_organisation_path(@organisation), method: :post) %>
<%= govuk_button_link_to("Cancel", details_organisation_path(@organisation), secondary: true) %>

Loading…
Cancel
Save