FEATURE: customization of html emails (PR #7934)

Add a way to customize html emails via a template and css. Not covered is a way to customize anything not already covered by translation overrides (Admin > Customize > Email Templates).

Some outstanding items:

  • [x] Need to test translation overrides for some emails like “user_replied”. (It works)
  • [x] Trying to customize html template of all emails might clash with summary emails because there’s so much styling there, and it’s hard-coded instead of applied from Email::Styles.


You’ve signed the CLA, nlalonde. Thank you! This pull request is ready for review.

Hmm not sure this is actually doing anything.

EDIT: it’s needed for digest email, and anything else that would render html part using default ActionMailer rendering.

This should likely be reads

You could export default RestModel.extend here and not put it in a constant.

Since you’re using a RestModel you probably don’t need to implement this method, and could install call model.update(...) instead of model.saveChanges()

This variable is only used in the route and never observed so I’d recommend making it a this._shouldAlertUnsavedChanges = true - no need for get/set and it’s obvious it’s private.

Similar to my comment above you should be able to say this.store.find('emailStyle') to do this automatically.

Seems like a deccent idea to add some text here.

This might be a good fit for the HasErrors mixin which includes a way to add errors easily, and the serializer knows how to render it for display in a popup.

I know you didn’t add this but :scream:

Did we have a discussion about this gem anywhere that I might have missed? We are very stingy about adding new things and must do due-diligence to make sure they meet our standards.

Yeah there were a lot of discoveries about html rendering in email clients while working on the summary email…

Nope, and I’d be happy to use another solution to do the same. Was hoping nokogiri could do this, but it doesn’t.

I tried this, but RestModel doesn’t know about singular resources, so I shouldn’t make this a RestModel.

@nlalonde I worked on the beginning of a patch which should do multple things @eviltrout mentionned:


Hope it helps

Ah right, everything needs an ID.

Okay I’ve created a document on our developer forum about the dependency. If we add the dependency it should be require: false and only required when we intend to use it, since it’s probably a rarely used code path.

Looking great now! I think we should just clear the gem first.

The UI is currently broken because rest model is trying to load /email_styles, but it should be /admin/customize/email_style. I’m trying to fix. I commented yesterday about rest model not understanding singular resources, and that still is a problem after Joffrey’s changes. I think it needs to be in ADMIN_MODELS and server needs some alias routes.