mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 02:04:53 +08:00
update message bus to support per client filtering
start work on user_tracking_state fix can_ban? in guardian expose protected scopes on topic_query we need move guardian spec to use build as opposed to creating topics / posts / users start work on user tracking spec
This commit is contained in:
@ -190,6 +190,19 @@ class TopicQuery
|
||||
create_list(:new_in_category) {|l| l.where(category_id: category.id).by_newest.first(25)}
|
||||
end
|
||||
|
||||
def new_results(list_opts={})
|
||||
default_list(list_opts)
|
||||
.where("topics.created_at >= :created_at", created_at: @user.treat_as_new_topic_start_date)
|
||||
.where("tu.last_read_post_number IS NULL")
|
||||
.where("COALESCE(tu.notification_level, :tracking) >= :tracking", tracking: TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
def unread_results(list_opts={})
|
||||
default_list(list_opts)
|
||||
.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])
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def create_list(filter, list_opts={})
|
||||
@ -240,18 +253,6 @@ class TopicQuery
|
||||
result
|
||||
end
|
||||
|
||||
def new_results(list_opts={})
|
||||
default_list(list_opts)
|
||||
.where("topics.created_at >= :created_at", created_at: @user.treat_as_new_topic_start_date)
|
||||
.where("tu.last_read_post_number IS NULL")
|
||||
.where("COALESCE(tu.notification_level, :tracking) >= :tracking", tracking: TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
def unread_results(list_opts={})
|
||||
default_list(list_opts)
|
||||
.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])
|
||||
end
|
||||
|
||||
def random_suggested_results_for(topic, count, exclude_topic_ids)
|
||||
results = default_list(unordered: true, per_page: count)
|
||||
|
Reference in New Issue
Block a user