mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 22:43:43 +08:00
FIX: Circular references warning in TopicTrackingState
.
This commit is contained in:
parent
ab2f3e43eb
commit
d5c828213f
|
@ -246,7 +246,10 @@ SQL
|
||||||
sql
|
sql
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.publish_private_message(topic, user_id: user_id, user_archive: false, post: nil, group_archive: false)
|
def self.publish_private_message(topic, archive_user_id: archive_user_id,
|
||||||
|
post: nil,
|
||||||
|
group_archive: false)
|
||||||
|
|
||||||
return unless topic.private_message?
|
return unless topic.private_message?
|
||||||
channels = {}
|
channels = {}
|
||||||
|
|
||||||
|
@ -254,8 +257,8 @@ SQL
|
||||||
|
|
||||||
if post && allowed_user_ids.include?(post.user_id)
|
if post && allowed_user_ids.include?(post.user_id)
|
||||||
channels["/private-messages/sent"] = [post.user_id]
|
channels["/private-messages/sent"] = [post.user_id]
|
||||||
elsif user_archive
|
elsif archive_user_id
|
||||||
user_ids = [user_id]
|
user_ids = [archive_user_id]
|
||||||
|
|
||||||
[
|
[
|
||||||
"/private-messages/archive",
|
"/private-messages/archive",
|
||||||
|
|
|
@ -38,7 +38,7 @@ class UserArchivedMessage < ActiveRecord::Base
|
||||||
|
|
||||||
def self.publish_topic_tracking_state(topic, user_id)
|
def self.publish_topic_tracking_state(topic, user_id)
|
||||||
TopicTrackingState.publish_private_message(
|
TopicTrackingState.publish_private_message(
|
||||||
topic, user_id: user_id, user_archive: true
|
topic, archive_user_id: user_id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -189,8 +189,7 @@ describe TopicTrackingState do
|
||||||
messages = MessageBus.track_publish do
|
messages = MessageBus.track_publish do
|
||||||
TopicTrackingState.publish_private_message(
|
TopicTrackingState.publish_private_message(
|
||||||
private_message_topic,
|
private_message_topic,
|
||||||
user_id: private_message_post.user_id,
|
archive_user_id: private_message_post.user_id,
|
||||||
user_archive: true
|
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user