mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Avoid publishing changes if the topic was deleted
This commit is contained in:
@@ -345,7 +345,7 @@ SQL
|
|||||||
def self.publish_read_indicator_on_write(topic_id, last_read_post_number, user_id)
|
def self.publish_read_indicator_on_write(topic_id, last_read_post_number, user_id)
|
||||||
topic = Topic.includes(:allowed_groups).select(:highest_post_number, :archetype, :id).find_by(id: topic_id)
|
topic = Topic.includes(:allowed_groups).select(:highest_post_number, :archetype, :id).find_by(id: topic_id)
|
||||||
|
|
||||||
if topic.private_message?
|
if topic&.private_message?
|
||||||
groups = read_allowed_groups_of(topic)
|
groups = read_allowed_groups_of(topic)
|
||||||
update_topic_list_read_indicator(topic, groups, topic.highest_post_number, user_id, true)
|
update_topic_list_read_indicator(topic, groups, topic.highest_post_number, user_id, true)
|
||||||
end
|
end
|
||||||
@@ -354,7 +354,7 @@ SQL
|
|||||||
def self.publish_read_indicator_on_read(topic_id, last_read_post_number, user_id)
|
def self.publish_read_indicator_on_read(topic_id, last_read_post_number, user_id)
|
||||||
topic = Topic.includes(:allowed_groups).select(:highest_post_number, :archetype, :id).find_by(id: topic_id)
|
topic = Topic.includes(:allowed_groups).select(:highest_post_number, :archetype, :id).find_by(id: topic_id)
|
||||||
|
|
||||||
if topic.private_message?
|
if topic&.private_message?
|
||||||
groups = read_allowed_groups_of(topic)
|
groups = read_allowed_groups_of(topic)
|
||||||
post = Post.find_by(topic_id: topic.id, post_number: last_read_post_number)
|
post = Post.find_by(topic_id: topic.id, post_number: last_read_post_number)
|
||||||
trigger_post_read_count_update(post, groups)
|
trigger_post_read_count_update(post, groups)
|
||||||
|
|||||||
Reference in New Issue
Block a user