mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:42:45 +08:00
BUGFIX: muted categories showing up in new via message bus
This commit is contained in:
parent
9007d96466
commit
fed8f7c6f2
|
@ -17,6 +17,13 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
|||
tracker.incrementMessageCount();
|
||||
}
|
||||
|
||||
if (data.message_type === "new_topic"){
|
||||
var ignored_categories = Discourse.User.currentProp("muted_category_ids");
|
||||
if(_.include(ignored_categories, data.payload.category_id)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (data.message_type === "new_topic" || data.message_type === "unread" || data.message_type === "read") {
|
||||
tracker.notify(data);
|
||||
var old = tracker.states["t" + data.topic_id];
|
||||
|
|
|
@ -26,7 +26,8 @@ class TopicTrackingState
|
|||
last_read_post_number: nil,
|
||||
highest_post_number: 1,
|
||||
created_at: topic.created_at,
|
||||
topic_id: topic.id
|
||||
topic_id: topic.id,
|
||||
category_id: topic.category_id
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
:should_be_redirected_to_top,
|
||||
:redirected_to_top_reason,
|
||||
:disable_jump_reply,
|
||||
:custom_fields
|
||||
:custom_fields,
|
||||
:muted_category_ids
|
||||
|
||||
def include_site_flagged_posts_count?
|
||||
object.staff?
|
||||
|
@ -93,4 +94,10 @@ class CurrentUserSerializer < BasicUserSerializer
|
|||
end
|
||||
end
|
||||
|
||||
def muted_category_ids
|
||||
@muted_category_ids ||= CategoryUser.where(user_id: object.id,
|
||||
notification_level: TopicUser.notification_levels[:muted])
|
||||
.pluck(:category_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user