Refactor MessageBuilder to put mail footer 'action links' always in signature?


(Robert) #1

Hello,

I recently had a look into message_builder.rb to check out how the last few lines of most mails are generated:

[mail body]

---
[Visit Topic](https://meta.discourse.org/t/how-to-enable-piwik-analytics-on-discourse/33090/24) or reply to this email to respond.

To unsubscribe from these emails, [click here](https://meta.discourse.org/email/unsubscribe/3b1425417...e06a018707abea59569cca94999).

Here, we have two elements:

  1. link to the topic with invitation to reply per mail
  2. link to unsubscribe.

Both links do not contain any content and should not make it into the reply. Proper (for some definition of proper) mail clients will strip of the signature when quoting the original message in the reply. That’s nice.

In the message_builder.rb we find:

@template_args[:respond_instructions] = "-- \n" + I18n.t(string, @template_args)

and there is also:

@template_args[:unsubscribe_instructions] = I18n.t(unsubscribe_string, @template_args)

So I was asking myself, do we get the -- \n also in the case that we use only the link (1.), but not (2.) to ensure that we got a signature also if we do not use respond_instructions? I do not think so. Maybe that’s a configuration that never occurs. :question:

Find the current file here: discourse/message_builder.rb at master · discourse/discourse · GitHub


(Jeff Atwood) #2

This is Markdown. You are misreading the markup.


(Robert) #3

Then is probably my last merged commit a regression. :frowning: @zogstrip

Any hint where I can find the code for the signature. I grep-ed lot and tried to find and write a spec (the latter without success).