mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 08:17:56 +08:00
FIX: whisper no longer experimental
- Regular users are not notified of whispers - Regular users no longer have "stuck" topics in unread - Additional tracking for staff highest post number - Remove a bunch of unused columns in topics table
This commit is contained in:
@ -242,9 +242,12 @@ class TopicQuery
|
||||
.where("COALESCE(tu.notification_level, :tracking) >= :tracking", tracking: TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
def self.unread_filter(list)
|
||||
list.where("tu.last_read_post_number < topics.highest_post_number")
|
||||
.where("COALESCE(tu.notification_level, :regular) >= :tracking", regular: TopicUser.notification_levels[:regular], tracking: TopicUser.notification_levels[:tracking])
|
||||
def self.unread_filter(list, opts)
|
||||
col_name = opts[:staff] ? "highest_staff_post_number" : "highest_post_number"
|
||||
|
||||
list.where("tu.last_read_post_number < topics.#{col_name}")
|
||||
.where("COALESCE(tu.notification_level, :regular) >= :tracking",
|
||||
regular: TopicUser.notification_levels[:regular], tracking: TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
def prioritize_pinned_topics(topics, options)
|
||||
@ -320,7 +323,7 @@ class TopicQuery
|
||||
end
|
||||
|
||||
def unread_results(options={})
|
||||
result = TopicQuery.unread_filter(default_results(options.reverse_merge(:unordered => true)))
|
||||
result = TopicQuery.unread_filter(default_results(options.reverse_merge(:unordered => true)), staff: @user.try(:staff?))
|
||||
.order('CASE WHEN topics.user_id = tu.user_id THEN 1 ELSE 2 END')
|
||||
|
||||
self.class.results_filter_callbacks.each do |filter_callback|
|
||||
@ -656,7 +659,7 @@ class TopicQuery
|
||||
end
|
||||
|
||||
def unread_messages(params)
|
||||
TopicQuery.unread_filter(messages_for_groups_or_user(params[:my_group_ids]))
|
||||
TopicQuery.unread_filter(messages_for_groups_or_user(params[:my_group_ids]), staff: @user.try(:staff?))
|
||||
.limit(params[:count])
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user