diff --git a/.rubocop.yml b/.rubocop.yml index 8bd936552..f5abc6b74 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -289,43 +289,43 @@ Lint/BooleanSymbol: Enabled: true Lint/CircularArgumentReference: - Enabled: false + Enabled: true Lint/Debugger: - Enabled: false + Enabled: true Lint/DeprecatedClassMethods: - Enabled: false + Enabled: true Lint/DuplicateCaseCondition: - Enabled: false + Enabled: true Lint/DuplicateMethods: - Enabled: false + Enabled: true Lint/DuplicatedKey: - Enabled: false + Enabled: true Lint/EachWithObjectArgument: - Enabled: false + Enabled: true Lint/ElseLayout: - Enabled: false + Enabled: true Lint/EmptyEnsure: - Enabled: false + Enabled: true Lint/EmptyExpression: - Enabled: false + Enabled: true Lint/EmptyInterpolation: - Enabled: false + Enabled: true Lint/EmptyWhen: - Enabled: false + Enabled: true Lint/EndInMethod: - Enabled: false + Enabled: true Lint/EnsureReturn: Enabled: false diff --git a/app/models/commentaire.rb b/app/models/commentaire.rb index aa0ac07e1..5db55fd13 100644 --- a/app/models/commentaire.rb +++ b/app/models/commentaire.rb @@ -31,19 +31,12 @@ class Commentaire < ActiveRecord::Base dossier_user_email = dossier.user.email invited_users_emails = dossier.invites_user.pluck(:email).to_a - case email - when I18n.t("dynamics.contact_email") - # The commentaire is a copy of an automated notification email - # we sent to a user, so do nothing - - when dossier_user_email, *invited_users_emails - # A user or an inved user posted a commentaire, - # do nothing, the notification system will properly - - else - # A gestionnaire posted a commentaire, - # we need to notify the user - + # - If the email is the contact email, the commentaire is a copy + # of an automated notification email we sent to a user, so do nothing. + # - If a user or an invited user posted a commentaire, do nothing, + # the notification system will properly + # - Otherwise, a gestionnaire posted a commentaire, we need to notify the user + if !email.in?([I18n.t("dynamics.contact_email"), dossier_user_email, *invited_users_emails]) notify_user end end diff --git a/app/services/staging_auth_service.rb b/app/services/staging_auth_service.rb index d6703e794..c6886f5a2 100644 --- a/app/services/staging_auth_service.rb +++ b/app/services/staging_auth_service.rb @@ -14,7 +14,7 @@ class StagingAuthService end def self.config - if File.exists?(CONFIG_PATH) + if File.exist?(CONFIG_PATH) YAML.safe_load(File.read(CONFIG_PATH)).symbolize_keys else {}