How to control previous replies in emails

(Sam Saffron) #1

When Discourse sends out Email notifications it includes a block of “Previous Replies”

This can be controlled on your user profile.

Out of the box we will include up to 5 posts at the bottom of email notifications provided we have not emailed them in the past.

If you are uneasy with that default you can change it to “never” send you previous replies, or “always” send you previous replies.

The default for all users can be controlled by forum admins, default email previous replies

The number of posts included in previous replies can also be controlled using the email posts context site setting.

Understanding context in email notifications, possible bug with OP not included
Forcing email context
Subscription emails should carry more context in message body
Override existing user preferences
Forcing email context - input requested
Option to force email context
(Jeff Atwood) #2

Shouldn’t it be “unless already read?” or perhaps “if I haven’t read them yet?”

Always and Never are straightforward, but I am unclear on the exact logic of the middle path here. And that is the default yes?

(Sam Saffron) #3
 if topic_user && topic_user.last_emailed_post_number && user_option.try(:email_previous_replies) == UserOption.previous_replies_type[:unless_emailed]
      context_posts = context_posts.where("post_number > ?", topic_user.last_emailed_post_number)

Whenever we send an email to a user we track last_emailed_post_number on the TopicUser table.

Yes, this is the default.

(Allen - Watchman Monitoring) #4

I see the options in Admin for all new user defaults (nice)

How can set “Always” for all current members?

(I’m thinking of a one-time action, they could edit later as desired)

(Allen - Watchman Monitoring) #5

I’m assuming something like:

/launcher enter app
rails c
User.update_all(email_previous_replies: …

which enum represents “always”?

(Sam Saffron) #6

0 though I probably should change it.

(Allen - Watchman Monitoring) #7

It would be great to document how to set this… unless there are plans to add an “apply to all” in the defaults setting in the Admin default sections

(Sam Saffron) #8
./launcher enter app
rails c
> UserOption.update_all(email_previous_replies: 0)

Done … all your users now will ALWAYS get previous replies for every email we send.

Subscription emails should carry more context in message body
(Allen - Watchman Monitoring) #9

yep, right until they choose otherwise.

Thank you!

Override existing user preferences
(Kim Miller) #10

I might be able to guess, but for the record what’s the command for setting all users to “Unless Previously Sent”? “1”?