FEATURE: Assigning a user to a topic will make user watch the topic.
This commit is contained in:
parent
6e7f01e5d4
commit
9bea971196
|
@ -144,6 +144,13 @@ SQL
|
|||
|
||||
publish_topic_tracking_state(@topic, assign_to.id)
|
||||
|
||||
TopicUser.change(
|
||||
assign_to.id,
|
||||
@topic.id,
|
||||
notification_level: TopicUser.notification_levels[:watching],
|
||||
notifications_reason_id: TopicUser.notification_reasons[:plugin_changed]
|
||||
)
|
||||
|
||||
if SiteSetting.assign_mailer_enabled
|
||||
if !@topic.muted?(assign_to)
|
||||
message = AssignMailer.send_assignment(assign_to.email, @topic, @assigned_by)
|
||||
|
@ -201,6 +208,13 @@ SQL
|
|||
|
||||
post.publish_change_to_clients!(:revised, reload_topic: true)
|
||||
|
||||
TopicUser.change(
|
||||
assigned_to_id,
|
||||
@topic.id,
|
||||
notification_level: TopicUser.notification_levels[:tracking],
|
||||
notifications_reason_id: TopicUser.notification_reasons[:plugin_changed]
|
||||
)
|
||||
|
||||
assigned_user = User.find_by(id: assigned_to_id)
|
||||
MessageBus.publish(
|
||||
"/staff/topic-assignment",
|
||||
|
|
|
@ -31,9 +31,22 @@ RSpec.describe TopicAssigner do
|
|||
|
||||
it "can assign and unassign correctly" do
|
||||
assigner.assign(moderator)
|
||||
expect(TopicQuery.new(moderator, assigned: moderator.username).list_latest.topics).to be_present
|
||||
|
||||
expect(TopicQuery.new(
|
||||
moderator, assigned: moderator.username
|
||||
).list_latest.topics).to eq([topic])
|
||||
|
||||
expect(TopicUser.find_by(user: moderator).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:watching])
|
||||
|
||||
assigner.unassign
|
||||
expect(TopicQuery.new(moderator, assigned: moderator.username).list_latest.topics).to be_blank
|
||||
|
||||
expect(TopicQuery.new(
|
||||
moderator, assigned: moderator.username
|
||||
).list_latest.topics).to eq([])
|
||||
|
||||
expect(TopicUser.find_by(user: moderator).notification_level)
|
||||
.to eq(TopicUser.notification_levels[:tracking])
|
||||
end
|
||||
|
||||
it "can unassign all a user's topics at once" do
|
||||
|
|
Loading…
Reference in New Issue