mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: whitelist post_types used in context in email notifications
This commit is contained in:
@@ -186,11 +186,14 @@ class UserNotifications < ActionMailer::Base
|
||||
end
|
||||
|
||||
def self.get_context_posts(post, topic_user)
|
||||
allowed_post_types = [Post.types[:regular]]
|
||||
allowed_post_types << Post.types[:whisper] if topic_user.try(:user).try(:staff?)
|
||||
|
||||
context_posts = Post.where(topic_id: post.topic_id)
|
||||
.where("post_number < ?", post.post_number)
|
||||
.where(user_deleted: false)
|
||||
.where(hidden: false)
|
||||
.where(post_type: Topic.visible_post_types)
|
||||
.where(post_type: allowed_post_types)
|
||||
.order('created_at desc')
|
||||
.limit(SiteSetting.email_posts_context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user