1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

notify users after privacy policy update + hide undefined content

This commit is contained in:
Sylvain 2019-04-25 11:40:26 +02:00
parent 531e298b14
commit 162a56250a
17 changed files with 73 additions and 26 deletions

View File

@ -1,29 +1,20 @@
/* eslint-disable
no-return-assign,
no-undef,
*/
// TODO: This file was created by bulk-decaffeinate.
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
'use strict';
Application.Controllers.controller('AboutController', ['$scope', 'Setting', 'CustomAsset', function ($scope, Setting, CustomAsset) {
/* PUBLIC SCOPE */
Setting.get({ name: 'about_title' }, data => $scope.aboutTitle = data.setting);
Setting.get({ name: 'about_title' }, data => { $scope.aboutTitle = data.setting; });
Setting.get({ name: 'about_body' }, data => $scope.aboutBody = data.setting);
Setting.get({ name: 'about_body' }, data => { $scope.aboutBody = data.setting; });
Setting.get({ name: 'about_contacts' }, data => $scope.aboutContacts = data.setting);
Setting.get({ name: 'about_contacts' }, data => { $scope.aboutContacts = data.setting; });
Setting.get({ name: 'privacy_body' }, data => { $scope.privacyPolicy = data.setting; });
// retrieve the CGU
CustomAsset.get({ name: 'cgu-file' }, cgu => $scope.cgu = cgu.custom_asset);
CustomAsset.get({ name: 'cgu-file' }, cgu => { $scope.cgu = cgu.custom_asset; });
// retrieve the CGV
return CustomAsset.get({ name: 'cgv-file' }, cgv => $scope.cgv = cgv.custom_asset);
CustomAsset.get({ name: 'cgv-file' }, cgv => { $scope.cgv = cgv.custom_asset; });
}
]);

View File

@ -308,7 +308,7 @@ Application.Controllers.controller('SettingsController', ['$scope', '$filter', '
}
if (profileImageFile.custom_asset) {
$scope.methods.profileImage = 'put';
return $scope.actionUrl.profileImage += '/profile-image-file';
$scope.actionUrl.profileImage += '/profile-image-file';
}
privacyDraftsPromise.setting.history.forEach(function (draft) {

View File

@ -16,7 +16,7 @@
<p ng-show="cgv">
<a href="{{cgv.custom_asset_file_attributes.attachment_url}}" target="_blank" translate>{{ 'about.read_the_fablab_s_general_terms_and_conditions' }}</a>
</p>
<p ng-show="cgv">
<p ng-show="privacyPolicy.value">
<a ui-sref="app.public.privacy" translate>{{ 'about.privacy_policy' }}</a>
</p>
</div>

View File

@ -16,7 +16,7 @@
<span ng-bind-html="privacyBody.value"></span>
</div>
<div class="col-sm-offset-0 col-md-offset-0 col-lg-offset-1 col-sm-4 col-md-4">
<div class="col-sm-offset-0 col-md-offset-0 col-lg-offset-1 col-sm-4 col-md-4" ng-show="privacyDpo.value">
<h2 class="about-title-aside text-u-c" translate>{{ 'privacy.dpo' }}</h2>
<span ng-bind-html="privacyDpo.value"></span>
</div>

View File

@ -45,6 +45,7 @@ class NotificationType
notify_admin_free_disk_space
notify_admin_close_period_reminder
notify_admin_archive_complete
notify_privacy_policy_changed
]
# deprecated:
# - notify_member_subscribed_plan_is_changed

View File

@ -42,12 +42,20 @@ class Setting < ActiveRecord::Base
display_name_enable
machines_sort_by] }
after_update :update_stylesheet if :value_changed?
after_update :update_stylesheet, :notify_privacy_policy_changed if :value_changed?
def update_stylesheet
Stylesheet.first&.rebuild! if %w[main_color secondary_color].include? name
end
def notify_privacy_policy_changed
return unless name == 'privacy_body'
NotificationCenter.call type: :notify_privacy_policy_changed,
receiver: User.all,
attached_object: self
end
def value
last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first
last_value&.value

View File

@ -0,0 +1,4 @@
json.title notification.notification_type
json.description t('.policy_updated') +
"<a href='/#!/privacy-policy>#{t('.click_to_show')}</a>."
json.url notification_url(notification, format: :json)

View File

@ -0,0 +1,7 @@
<%= render 'notifications_mailer/shared/hello', recipient: @recipient %>
<%= t('.body.content_html') %>
<p>
<%=link_to( t('.body.link_to_policy'), "#{root_url}#!/privacy-policy", target: "_blank" )%>
</p>

View File

@ -318,7 +318,9 @@ en:
warning_no_closed_periods: "Please remind to periodically close your accounting periods. You have to close periods from %{FIRST_DATE}"
notify_admin_archive_complete:
archive_complete: "Data archiving from %{START} to %{END} is done. <a href='api/accounting_periods/%{ID}/archive' target='_blank'>click here to download</a>. Remember to save it on an external secured media."
notify_privacy_policy_changed:
policy_updated: "Privacy policy updated."
click_to_show: "Click here to consult"
statistics:
# statistics tools for admins
subscriptions: "Subscriptions"

View File

@ -318,7 +318,9 @@ es:
warning_no_closed_periods: "Please remind to periodically close your accounting periods. You have to close periods from %{FIRST_DATE}" # missing translation
notify_admin_archive_complete: # missing translation
archive_complete: "Data archiving from %{START} to %{END} is done. <a href='api/accounting_periods/%{ID}/archive' target='_blank'>click here to download</a>. Remember to save it on an external secured media." # missing translation
notify_privacy_policy_changed:
policy_updated: "Privacy policy updated." # missing translation
click_to_show: "Click here to consult" # missing translation
statistics:
# statistics tools for admins
subscriptions: "Suscripciones"

View File

@ -318,6 +318,9 @@ fr:
warning_no_closed_periods: "Pensez à clôturer régulièrement vos périodes comptables. Vous devez clôturer des périodes depuis le %{FIRST_DATE}"
notify_admin_archive_complete:
archive_complete: "L'archivage des données du %{START} au %{END} est terminé. <a href='api/accounting_periods/%{ID}/archive' target='_blank'>Cliquez ici pour la télécharger</a>. Pensez à l'enregistrer sur un support externe sécurisé."
notify_privacy_policy_changed:
policy_updated: "Nouvelle mise à jour de la Politique de confidentialité."
click_to_show: "Cliquez ici pour la consulter"
statistics:
# outil de statistiques pour les administrateurs

View File

@ -294,5 +294,11 @@ en:
here: "here."
save_on_secured: "Remember that you must save this archive on a secured external support, which may be requested by the tax authorities during a check."
notify_privacy_policy_changed:
subject: "Privacy policy updated"
body:
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
shared:
hello: "Hello %{user_name}"

View File

@ -293,5 +293,11 @@ es:
here: "here."
save_on_secured: "Remember that you must save this archive on a secured external support, which may be requested by the tax authorities during a check."
notify_privacy_policy_changed: #translation_missing
subject: "Privacy policy updated"
body:
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
shared:
hello: "¡Hola %{user_name}!"

View File

@ -294,5 +294,11 @@ fr:
here: "ici."
save_on_secured: "N'oubliez pas que vous devez obligatoirement enregistrer cette archive sur un support externe sécurisé, qui peut vous être demandé par l'administration fiscale lors d'un contrôle."
notify_privacy_policy_changed:
subject: "Mise à jour de la Politique de confidentialité"
body:
content_html: "<p>Nous souhaitons vous signaler que nous venons de mettre à jour notre politique de confidentialité.</p><p>Nous pouvons apporter régulièrement des modifications à notre politique de confidentialité. Conformément à la réglementation, une notification vous sera envoyée à chaque mise à jour.</p><p>En accédant ou en utilisant nos services après la mise à jour de la Politique de confidentialité, nous considérerons que vous acceptez les termes de celle-ci, mises à jour comprises.</p>"
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
shared:
hello: "Bonjour %{user_name}"

View File

@ -294,5 +294,11 @@ pt:
here: "here."
save_on_secured: "Remember that you must save this archive on a secured external support, which may be requested by the tax authorities during a check."
notify_privacy_policy_changed: #translation_missing
subject: "Privacy policy updated"
body:
content_html: "<p>We wish to inform you that we have just updated our privacy policy.</p><p>We may change our privacy policy regularly. In accordance with the regulations, you will receive a notification for each update.</p><p>By accessing or using our services after the privacy policy update, we will consider that you agree its terms, updates included.</p>"
link_to_policy: "Cliquez ici pour consultez la politique de confidentialité."
shared:
hello: "Olá %{user_name}"

View File

@ -318,7 +318,9 @@ pt:
warning_no_closed_periods: "Please remind to periodically close your accounting periods. You have to close periods from %{FIRST_DATE}" # missing translation
notify_admin_archive_complete: # missing translation
archive_complete: "Data archiving from %{START} to %{END} is done. <a href='api/accounting_periods/%{ID}/archive' target='_blank'>click here to download</a>. Remember to save it on an external secured media." # missing translation
notify_privacy_policy_changed:
policy_updated: "Privacy policy updated." # missing translation
click_to_show: "Click here to consult" # missing translation
statistics:
# statistics tools for admins
subscriptions: "Assinaturas"

View File

@ -1,8 +1,11 @@
# frozen_string_literal: true
Spring.after_fork do
if ENV['DEBUGGER_STORED_RUBYLIB']
starter = ENV['BUNDLER_ORIG_RUBYOPT'][2..-1]
load(starter + '.rb')
ENV['DEBUGGER_STORED_RUBYLIB'].split(File::PATH_SEPARATOR).each do |path|
next unless path =~ /ruby-debug-ide/
load path + '/ruby-debug-ide/multiprocess/starter.rb'
end
end
end
end