diff --git a/lib/assigner.rb b/lib/assigner.rb index 5880a0f1..71656868 100644 --- a/lib/assigner.rb +++ b/lib/assigner.rb @@ -372,22 +372,6 @@ def unassign(silent: false, deactivate: false) assigned_to_type: assignment.assigned_to_type, ) - if assignment.assigned_to_user? - if TopicUser.exists?( - user_id: assignment.assigned_to_id, - topic: topic, - notification_level: TopicUser.notification_levels[:watching], - notifications_reason_id: TopicUser.notification_reasons[:plugin_changed], - ) - TopicUser.change( - assignment.assigned_to_id, - topic.id, - notification_level: TopicUser.notification_levels[:tracking], - notifications_reason_id: TopicUser.notification_reasons[:plugin_changed], - ) - end - end - assigned_to = assignment.assigned_to if SiteSetting.unassign_creates_tracking_post && !silent diff --git a/spec/lib/assigner_spec.rb b/spec/lib/assigner_spec.rb index 87e4f8b9..7a2cb3b4 100644 --- a/spec/lib/assigner_spec.rb +++ b/spec/lib/assigner_spec.rb @@ -39,7 +39,7 @@ 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], + TopicUser.notification_levels[:watching], ) end @@ -122,23 +122,17 @@ } end - it "does not update notification level if it is not set by the plugin" do + it "does not update notification level when unassigned" do assigner.assign(moderator) expect(TopicUser.find_by(user: moderator).notification_level).to eq( TopicUser.notification_levels[:watching], ) - TopicUser.change( - moderator.id, - topic.id, - notification_level: TopicUser.notification_levels[:muted], - ) - assigner.unassign expect(TopicUser.find_by(user: moderator, topic: topic).notification_level).to eq( - TopicUser.notification_levels[:muted], + TopicUser.notification_levels[:watching], ) end