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