When Discourse sends out Email notifications, it can include a block of “Previous Replies”.
This can be controlled on your user profile. In the
Include previous replies at the bottom of emails setting.
Out of the box we don’t include previous replies in email notifications, instead we include and excerpt of the post being replied to at the bottom of the notification. So the default for the
Include previous replies at the bottom of emails setting is
You can change it to
always, or to
unless previously sent, to receive previous replies unless they were already sent in a previous email. By default, we will include up to 5 posts at the bottom of email notifications, provided we have not emailed them in the past. This can be changed with the
email posts context site setting
This logic is controlled by this code
if topic_user && topic_user.last_emailed_post_number && user.user_option.email_previous_replies == UserOption.previous_replies_type[:unless_emailed] context_posts = context_posts.where("post_number > ?", topic_user.last_emailed_post_number) end
Whenever we send an email to a user we track
last_emailed_post_number on the
TopicUser table. That way, if
unless previously sent is enabled, we know which replies were already emailed.
The default for all users can be controlled by forum admins, int the
default email previous replies site setting. When changing this setting, you will have the option to apply the change historically, to all existing users, or to new users only.
You could also do this manually, from the rails console
./launcher enter app rails c > UserOption.update_all(email_previous_replies: 0)
email_previous_replies can have one of the these values:
- 0: always
- 1: unless previously sent
- 2: never