diff --git a/CHANGELOG.md b/CHANGELOG.md index 802985382..2ed8f2abf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,9 @@ - Improved display of the icons alerting about an outdated version - Fix a bug: managers do not see the name of the user who reserved a slot +- Fix a bug: mailcatcher is not showing all emails - [TODO DEPLOY] `rails fablab:setup:env_to_db` +- [TODO DEPLOY] -> (only dev) update mailcatcher from your [docker-compose.yml](docker/development/docker-compose.yml) ## v4.4.4 2020 May 25 diff --git a/app/assets/javascripts/router.js.erb b/app/assets/javascripts/router.js.erb index d0fe3613d..17bf6e161 100644 --- a/app/assets/javascripts/router.js.erb +++ b/app/assets/javascripts/router.js.erb @@ -1031,7 +1031,7 @@ angular.module('application.router', ['ui.router']) resolve: { settingsPromise: ['Setting', function (Setting) { return Setting.query({ - names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', \ + names: `['twitter_name', 'about_title', 'about_body', 'tracking_id', 'facebook_app_id', 'email_from', \ 'privacy_body', 'privacy_dpo', 'about_contacts', 'book_overlapping_slots', 'invoicing_module', \ 'home_blogpost', 'machine_explications_alert', 'training_explications_alert', 'slot_duration', \ 'training_information_message', 'subscription_explications_alert', 'event_explications_alert', \ diff --git a/app/assets/templates/admin/settings/general.html b/app/assets/templates/admin/settings/general.html index 644f30230..61b3afc65 100644 --- a/app/assets/templates/admin/settings/general.html +++ b/app/assets/templates/admin/settings/general.html @@ -1,34 +1,34 @@
- {{ 'app.admin.settings.title' }} + {{ 'app.admin.settings.general.title' }}
-

{{ 'app.admin.settings.title_concordance' }}

+

{{ 'app.admin.settings.general.title_concordance' }}



@@ -318,20 +318,20 @@
- {{ 'app.admin.settings.elements_ordering' }} + {{ 'app.admin.settings.general.elements_ordering' }}
-

{{ 'app.admin.settings.machines_order' }}

+

{{ 'app.admin.settings.general.machines_order' }}

+ label="app.admin.settings.general.display_machines_sorted_by" + option-1="['default', 'app.admin.settings.general.sort_by.default']" + option-2="['name', 'app.admin.settings.general.sort_by.name']" + option-3="['created_at', 'app.admin.settings.general.sort_by.created_at']" + option-4="['updated_at', 'app.admin.settings.general.sort_by.updated_at']">
@@ -340,27 +340,47 @@
- {{ 'app.admin.settings.help' }} + {{ 'app.admin.settings.general.help' }}
-

{{ 'app.admin.settings.feature_tour' }}

-

+

{{ 'app.admin.settings.general.feature_tour' }}

+

+ label="app.admin.settings.general.feature_tour_display_mode" + option-1="['once', 'app.admin.settings.general.display_mode.once']" + option-2="['session', 'app.admin.settings.general.display_mode.session']" + option-3="['manual', 'app.admin.settings.general.display_mode.manual']">
+
+
+ {{ 'app.admin.settings.general.notifications' }} +
+
+
+

{{ 'app.admin.settings.general.email' }}

+

{{ 'app.admin.settings.general.email_info' }}

+
+ + +
+
+
+
+
{{ 'app.admin.settings.account_creation' }} diff --git a/app/assets/templates/admin/settings/index.html.erb b/app/assets/templates/admin/settings/index.html.erb index 882ebd271..86ddb7533 100644 --- a/app/assets/templates/admin/settings/index.html.erb +++ b/app/assets/templates/admin/settings/index.html.erb @@ -26,7 +26,7 @@
- + '"> diff --git a/app/mailers/base_mailer.rb b/app/mailers/base_mailer.rb index 353ba556c..d726c9484 100644 --- a/app/mailers/base_mailer.rb +++ b/app/mailers/base_mailer.rb @@ -2,7 +2,7 @@ # Mailer configuration class BaseMailer < ActionMailer::Base - default from: ENV['DEFAULT_MAIL_FROM'] + default from: Setting.get('mail_from') layout 'notifications_mailer' helper :application diff --git a/app/mailers/notifications_mailer.rb b/app/mailers/notifications_mailer.rb index 8ec5f7a89..c84478b5f 100644 --- a/app/mailers/notifications_mailer.rb +++ b/app/mailers/notifications_mailer.rb @@ -2,7 +2,7 @@ # Handle most of the emails sent by the platform. Triggered by notifications class NotificationsMailer < NotifyWith::NotificationsMailer - default from: ENV['DEFAULT_MAIL_FROM'] + default from: Setting.get('mail_from') layout 'notifications_mailer' helper :application diff --git a/app/mailers/overwritten_devise_mailer.rb b/app/mailers/overwritten_devise_mailer.rb new file mode 100644 index 000000000..a23b11a8a --- /dev/null +++ b/app/mailers/overwritten_devise_mailer.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +# Override the default Devise settings for emails notifications +class OverwrittenDeviseMailer < Devise::Mailer + helper :application + include Devise::Controllers::UrlHelpers + default template_path: 'devise/mailer' + default from: ->(*) { Setting.get('mail_from') } +end diff --git a/app/models/setting.rb b/app/models/setting.rb index bf831c20a..e7413c6fd 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -88,7 +88,8 @@ class Setting < ApplicationRecord twitter_analytics recaptcha_site_key recaptcha_secret_key - feature_tour_display] } + feature_tour_display + email_from] } def value last_value = history_values.order(HistoryValue.arel_table['created_at'].desc).first last_value&.value diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index f78e2e1ba..95df71d50 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -11,13 +11,8 @@ Devise.setup do |config| # config.secret_key = 'f0ad7aadec8086b90c0427e734602262e5d211147f3d93b5b94b5263ffd245e9fd9fcd672dcadea1d9ee2b1bffbf2712cdb013883d66943ef5bed93a263fe11a' # ==> Mailer Configuration - # Configure the e-mail address which will be shown in Devise::Mailer, - # note that it will be overwritten if you use your own mailer class - # with default "from" parameter. - config.mailer_sender = ENV['DEFAULT_MAIL_FROM'] - # Configure the class responsible to send e-mails. - # config.mailer = 'Devise::Mailer' + config.mailer = 'OverwrittenDeviseMailer' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 155554c7e..2c1e557fb 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -894,21 +894,9 @@ en: date: "Date" #global application parameters and customization settings: - title: "Title" customize_the_application: "Customize the application" - general: "General" - fablab_title: "FabLab title" fablab_name: "FabLab name" - title_concordance: "Title concordance" - male: "Male." - female: "Female." - neutral: "Neutral." - eg: "eg:" about: "About" - the_team: "The team of" - male_preposition: "the" - female_preposition: "the" - neutral_preposition: "" customize_information_messages: "Customize information messages" message_of_the_machine_booking_page: "Message of the machine booking page:" type_the_message_content: "Type the message content" @@ -1028,9 +1016,6 @@ en: twitter_analytics: "Twitter analytics account" book_overlapping_slots: "book overlapping slots" slot_duration: "slots duration" - elements_ordering: "Elements ordering" - machines_order: "Machines order" - display_machines_sorted_by: "Display machines sorted by" advanced: "Advanced settings" customize_home_page_css: "Customise the stylesheet of the home page" home_css_notice_html: "You can customize the stylesheet which will apply to the home page, using the SASS syntax. These styles will be automatically subordinated to the .home-page selector to prevent any risk of breaking the application. Meanwhile please be careful, any changes in the home page editor at the top of the page may broke your styles, always refer to the HTML code." @@ -1063,20 +1048,41 @@ en: secret_key: "Secret key" recaptcha_site_key: "reCAPTCHA Site Key" recaptcha_secret_key: "reCAPTCHA Secret Key" - help: "Help" - feature_tour: "Feature tour" - feature_tour_info_html: "

When an administrator or a manager in logged-in, a feature tour will be triggered the first time he/she visits each section of the application. You can change this behavior to one of the following values:

  • « Once » to keep the default behavior.
  • « By session » to display the tours each time you reopen the application.
  • « Manual trigger » to prevent displaying the tours automatically. It'll still be possible to trigger them by pressing the F1 key or by clicking on « Help » in the user's menu.
" - feature_tour_display_mode: "Feature tour display mode" feature_tour_display: "feature tour display" - display_mode: - once: "Once" - session: "By session" - manual: "Manual trigger" - sort_by: - default: "Default" - name: "Name" - created_at: "Creation date" - updated_at: "Last update date" + email_from: "expeditor's address" + general: + general: "General" + title: "Title" + fablab_title: "FabLab title" + title_concordance: "Title concordance" + male: "Male." + female: "Female." + neutral: "Neutral." + eg: "eg:" + the_team: "The team of" + male_preposition: "the" + female_preposition: "the" + neutral_preposition: "" + elements_ordering: "Elements ordering" + machines_order: "Machines order" + display_machines_sorted_by: "Display machines sorted by" + sort_by: + default: "Default" + name: "Name" + created_at: "Creation date" + updated_at: "Last update date" + help: "Help" + feature_tour: "Feature tour" + feature_tour_info_html: "

When an administrator or a manager in logged-in, a feature tour will be triggered the first time he/she visits each section of the application. You can change this behavior to one of the following values:

  • « Once » to keep the default behavior.
  • « By session » to display the tours each time you reopen the application.
  • « Manual trigger » to prevent displaying the tours automatically. It'll still be possible to trigger them by pressing the F1 key or by clicking on « Help » in the user's menu.
" + feature_tour_display_mode: "Feature tour display mode" + display_mode: + once: "Once" + session: "By session" + manual: "Manual trigger" + notifications: "Notifications" + email: "Email" + email_info: "The email address from which notifications will be sent. You can use a non-existing address (like noreply@...) or an existing address if you want to allow your members to reply to the notifications they receive." + email_from: "Expeditor's address" privacy: title: "Privacy" privacy_policy: "Privacy policy" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 91ddc34cf..24efa4f30 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -894,21 +894,8 @@ fr: date: "Date" #global application parameters and customization settings: - title: "Titre" customize_the_application: "Personnalisation de l'application" - general: "Général" - fablab_title: "Titre du FabLab" - fablab_name: "Nom du FabLab" - title_concordance: "Accord du titre" - male: "Masculin." - female: "Féminin." - neutral: "Neutre." - eg: "ex :" about: "A propos" - the_team: "L'équipe" - male_preposition: "du" - female_preposition: "de la" - neutral_preposition: "" customize_information_messages: "Personnaliser les messages d'informations" message_of_the_machine_booking_page: "Message sur la page de réservation d'une machine :" type_the_message_content: "Saisir le contenu du message" @@ -1028,9 +1015,6 @@ fr: twitter_analytics: "compte Twitter analytics" book_overlapping_slots: "réservation de créneaux simultanés" slot_duration: "durée des créneaux" - elements_ordering: "Ordre d'affichage des éléments" - machines_order: "Ordre des machines" - display_machines_sorted_by: "Afficher les machines triées par" advanced: "Paramètres avancés" customize_home_page_css: "Personnaliser la feuille de style de la page d'accueil" home_css_notice_html: "Vous pouvez personnaliser la feuille de style qui s'appliquera à la page d'accueil en utilisant la syntaxe SASS. Ces styles seront automatiquement subordonnées au sélecteur .home-page pour prévenir tout risque de casse de l'application. Attention toutefois, les modifications de la page d'accueil dans l'éditeur en haut de page peuvent rendre caduque vos styles, référez vous toujours au code HTML." @@ -1063,20 +1047,43 @@ fr: secret_key: "Clef secrète" recaptcha_site_key: "clef de site reCAPTCHA" recaptcha_secret_key: "clef secrète reCAPTCHA" - help: "Aide" - feature_tour: "Visite guidée des fonctionnalités" - feature_tour_info_html: "

Lorsque un administrateur ou un gestionnaire est connecté, une visite guidée des fonctionnalités se déclenchera lors de la première visite de chaque section de l'application. Vous pouvez modifier ce comportement pour une des valeur suivantes :

  • « Une fois » pour garder le comportment par défaut.
  • « Par session » pour afficher les visites guidées chaque fois que l'application est ouverte de nouveau.
  • « Lancement manuel » pour éviter l'affichage automatique des visites guidées. Il sera toujours possible de les déclencher en appuyant sur F1 ou en cliquant sur « Aide » dans le menu utilisateur.
" - feature_tour_display_mode: "Mode d'affichage des visites guidées" feature_tour_display: "l'affichage des visites guidées" - display_mode: - once: "Une fois" - session: "Par session" - manual: "Lancement manuel" - sort_by: - default: "Défaut" - name: "Nom" - created_at: "Date de création" - updated_at: "Date de mise à jour" + email_from: "l'adresse de l'expéditeur" + general: + general: "Général" + title: "Titre" + fablab_title: "Titre du FabLab" + fablab_name: "Nom du FabLab" + title_concordance: "Accord du titre" + male: "Masculin." + female: "Féminin." + neutral: "Neutre." + eg: "ex :" + about: "A propos" + the_team: "L'équipe" + male_preposition: "du" + female_preposition: "de la" + neutral_preposition: "" + elements_ordering: "Ordre d'affichage des éléments" + machines_order: "Ordre des machines" + display_machines_sorted_by: "Afficher les machines triées par" + sort_by: + default: "Défaut" + name: "Nom" + created_at: "Date de création" + updated_at: "Date de mise à jour" + help: "Aide" + feature_tour: "Visite guidée des fonctionnalités" + feature_tour_info_html: "

Lorsque un administrateur ou un gestionnaire est connecté, une visite guidée des fonctionnalités se déclenchera lors de la première visite de chaque section de l'application. Vous pouvez modifier ce comportement pour une des valeur suivantes :

  • « Une fois » pour garder le comportment par défaut.
  • « Par session » pour afficher les visites guidées chaque fois que l'application est ouverte de nouveau.
  • « Lancement manuel » pour éviter l'affichage automatique des visites guidées. Il sera toujours possible de les déclencher en appuyant sur F1 ou en cliquant sur « Aide » dans le menu utilisateur.
" + feature_tour_display_mode: "Mode d'affichage des visites guidées" + display_mode: + once: "Une fois" + session: "Par session" + manual: "Lancement manuel" + notifications: "Notifications" + email: "Courriel" + email_info: "L'adresse de courriel depuis laquelle les notifications seront envoyées. Vous pouvez utiliser une adresse qui n'existe pas (comme ne-pas-repondre@...) ou une adresse existante si vous voulez que vos membres puisse répondre aux notifications qu'ils reçoivent." + email_from: "Adresse de l'expéditeur" privacy: title: "Confidentialité" privacy_policy: "Politique de confidentialité" diff --git a/db/seeds.rb b/db/seeds.rb index 78856b52f..de87fd7b1 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -857,6 +857,8 @@ Setting.set('invoicing_module', true) unless Setting.find_by(name: 'invoicing_mo Setting.set('feature_tour_display', 'once') unless Setting.find_by(name: 'feature_tour_display').try(:value) +Setting.set('email_from', 'noreply@fab-manager.com') unless Setting.find_by(name: 'email_from').try(:value) + if StatisticCustomAggregation.count.zero? # available reservations hours for machines machine_hours = StatisticType.find_by(key: 'hour', statistic_index_id: 2) diff --git a/doc/environment.md b/doc/environment.md index 6e0a5d749..767f13eeb 100644 --- a/doc/environment.md +++ b/doc/environment.md @@ -99,11 +99,6 @@ This is useful if you won't use wallet system. If set to 'true' the users will need to confirm their email address to be able to sign in. Set to 'false' if you don't want this behaviour. - - - DEFAULT_MAIL_FROM - -When sending notification mails, the platform will use this address to identify the sender. DELIVERY_METHOD diff --git a/docker/development/docker-compose.yml b/docker/development/docker-compose.yml index 99dd318df..5397f7cd5 100644 --- a/docker/development/docker-compose.yml +++ b/docker/development/docker-compose.yml @@ -65,7 +65,7 @@ services: # - "6379:6379" mailcatcher: - image: sj26/mailcatcher + image: sleede/mailcatcher restart: always ## linux networks: diff --git a/env.example b/env.example index fcd09d632..d692e0d8d 100644 --- a/env.example +++ b/env.example @@ -22,8 +22,6 @@ FABLAB_WITHOUT_WALLET=false USER_CONFIRMATION_NEEDED_TO_SIGN_IN=false -DEFAULT_MAIL_FROM=Fab-manager Demo - # Configure carefully! DEFAULT_HOST=localhost:5000 DEFAULT_PROTOCOL=http diff --git a/lib/tasks/fablab/setup.rake b/lib/tasks/fablab/setup.rake index 3756ff604..786567c56 100644 --- a/lib/tasks/fablab/setup.rake +++ b/lib/tasks/fablab/setup.rake @@ -118,7 +118,8 @@ namespace :fablab do %w[_ TWITTER_NAME twitter_analytics], %w[_ RECAPTCHA_SITE_KEY recaptcha_site_key], %w[_ RECAPTCHA_SECRET_KEY recaptcha_secret_key], - %w[_ FEATURE_TOUR_DISPLAY feature_tour_display once] + %w[_ FEATURE_TOUR_DISPLAY feature_tour_display once], + %w[_ DEFAULT_MAIL_FROM email_from] ] mapping.each do |m| diff --git a/setup/env.example b/setup/env.example index e03f5dc84..6c9a2a53b 100644 --- a/setup/env.example +++ b/setup/env.example @@ -16,7 +16,6 @@ FABLAB_WITHOUT_WALLET=false SLOT_DURATION=60 FEATURE_TOUR_DISPLAY=once -DEFAULT_MAIL_FROM=Fab-manager Demo DEFAULT_HOST=demo.fab-manager.com DEFAULT_PROTOCOL=http diff --git a/test/fixtures/history_values.yml b/test/fixtures/history_values.yml index 37eeac774..e045e6767 100644 --- a/test/fixtures/history_values.yml +++ b/test/fixtures/history_values.yml @@ -593,3 +593,39 @@ history_value_61: created_at: 2020-05-22 15:22:08.254410000 Z updated_at: 2020-05-22 15:22:08.254410000 Z footprint: + +history_value_62: + id: 62 + setting_id: 62 + invoicing_profile_id: 1 + value: 'false' + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + footprint: + +history_value_63: + id: 63 + setting_id: 63 + invoicing_profile_id: 1 + value: 'true' + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + footprint: + +history_value_64: + id: 64 + setting_id: 64 + invoicing_profile_id: 1 + value: 'once' + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + footprint: + +history_value_65: + id: 65 + setting_id: 65 + invoicing_profile_id: 1 + value: 'noreply@fab-manager.com' + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + footprint: diff --git a/test/fixtures/settings.yml b/test/fixtures/settings.yml index 0fa1d1296..ad5b5a358 100644 --- a/test/fixtures/settings.yml +++ b/test/fixtures/settings.yml @@ -358,3 +358,28 @@ setting_61: name: slot_duration created_at: 2020-05-22 15:20:25.254250000 Z updated_at: 2020-05-22 15:20:25.254250000 Z + +setting_62: + id: 62 + name: spaces_module + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + +setting_63: + id: 63 + name: plans_module + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + +setting_64: + id: 64 + name: feature_tour_display + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z + +setting_65: + id: 65 + name: email_from + created_at: 2020-06-01 11:12:21.255550000 Z + updated_at: 2020-06-01 11:12:21.255550000 Z +