mirror of
https://github.com/discourse/discourse.git
synced 2025-02-22 04:07:27 +00:00
FIX: don't blow up if the topic does not exists anymore
PERF: only select the only field we use introduced in 7c741fa0d673f3c808cf3f77127e44e823ea40f8 (cc @romanrizzi)
This commit is contained in:
parent
48ee8f2abc
commit
e3eb49729c
@ -128,14 +128,14 @@ class TopicTrackingState
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.publish_read(topic_id, last_read_post_number, user_id, notification_level = nil)
|
def self.publish_read(topic_id, last_read_post_number, user_id, notification_level = nil)
|
||||||
topic = Topic.select(:highest_post_number, :archetype, :id).find_by(id: topic_id)
|
highest_post_number = DB.query_single("SELECT highest_post_number FROM topics WHERE id = ?", topic_id).first
|
||||||
|
|
||||||
message = {
|
message = {
|
||||||
topic_id: topic_id,
|
topic_id: topic_id,
|
||||||
message_type: "read",
|
message_type: "read",
|
||||||
payload: {
|
payload: {
|
||||||
last_read_post_number: last_read_post_number,
|
last_read_post_number: last_read_post_number,
|
||||||
highest_post_number: topic.highest_post_number,
|
highest_post_number: highest_post_number,
|
||||||
topic_id: topic_id,
|
topic_id: topic_id,
|
||||||
notification_level: notification_level
|
notification_level: notification_level
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user