mainio / decidim-module-term_customizer

Decidim module that allows customizing the localization terms in the system for specific contexts.
GNU Affero General Public License v3.0
16 stars 21 forks source link

fix: Devise email translation customization #109

Open Quentinchampenois opened 1 year ago

Quentinchampenois commented 1 year ago

Description

Current version does not allow to translate Devise emails translations (subjects, etc...)

Decidim::TermCustomizer::Context::JobContext doesn't handle the Devise job arguments format. At the moment, it expects Decidim jobs to have as argument a Decidim::Organization or Decidim::User in method resolve!.

I found that Devise mailer jobs contains a list of arguments and the expected argument in a Hash { args: [Decidim::User] } for example.

Related to

How to test

Create multiple devise translation customizations :

For account confirmation mails :

Create TermCustomizer entries

Refresh cache and create a new account

For reset password confirmation : Create TermCustomizer entries

Refresh cache and ask a reset password for user@example.org

For new admin invitation Create TermCustomizer entries

Refresh cache and invite a new admin

AyakorK commented 12 months ago

Hello @Quentinchampenois, we've noticed on few applications containing this branch on their Gemfile that we had an issue with the sending of notifications due to this line

arg = arg[:args].first if arg.is_a?(Hash)

We may need to identify the reason of the issue as soon as possible and find an alternative to this fix.

Quentinchampenois commented 1 week ago

Hello, I will work on resolving conflicts asap

About the change request, should I move the line : arg = arg[:args].first if arg.is_a?(Hash) && arg.has_key?(:args)

In the following methods : organization_from_argument, space_from_argument, component_from_argument or I keep it as it ?