mirror of
https://github.com/codeninjasllc/discourse.git
synced 2025-05-04 09:54:00 -04:00
BUGFIX: muted categories showing up in new via message bus
This commit is contained in:
parent
9007d96466
commit
fed8f7c6f2
3 changed files with 17 additions and 2 deletions
app
assets/javascripts/discourse/models
models
serializers
|
@ -17,6 +17,13 @@ Discourse.TopicTrackingState = Discourse.Model.extend({
|
||||||
tracker.incrementMessageCount();
|
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") {
|
if (data.message_type === "new_topic" || data.message_type === "unread" || data.message_type === "read") {
|
||||||
tracker.notify(data);
|
tracker.notify(data);
|
||||||
var old = tracker.states["t" + data.topic_id];
|
var old = tracker.states["t" + data.topic_id];
|
||||||
|
|
|
@ -26,7 +26,8 @@ class TopicTrackingState
|
||||||
last_read_post_number: nil,
|
last_read_post_number: nil,
|
||||||
highest_post_number: 1,
|
highest_post_number: 1,
|
||||||
created_at: topic.created_at,
|
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,
|
:should_be_redirected_to_top,
|
||||||
:redirected_to_top_reason,
|
:redirected_to_top_reason,
|
||||||
:disable_jump_reply,
|
:disable_jump_reply,
|
||||||
:custom_fields
|
:custom_fields,
|
||||||
|
:muted_category_ids
|
||||||
|
|
||||||
def include_site_flagged_posts_count?
|
def include_site_flagged_posts_count?
|
||||||
object.staff?
|
object.staff?
|
||||||
|
@ -93,4 +94,10 @@ class CurrentUserSerializer < BasicUserSerializer
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue