FIX: deprecate TopicAssigner (#221)

Delegate to assigner and add deprecation note
This commit is contained in:
Krzysztof Kotlarek 2021-10-27 15:42:51 +11:00 committed by GitHub
parent 7747bb81a0
commit 95cd224898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 0 deletions

42
lib/topic_assigner.rb Normal file
View File

@ -0,0 +1,42 @@
# frozen_string_literal: true
class ::TopicAssigner
def self.backfill_auto_assign
deprecation_note
Assigner.backfill_auto_assign
end
def self.assigned_self?(text)
deprecation_note
Assigner.assigned_self?(text)
end
def self.auto_assign(post, force: false)
deprecation_note
Assigner.auto_assign(post, force)
end
def self.is_last_staff_post?(post)
deprecation_note
Assigner.is_last_staff_post?(post)
end
def self.mentioned_staff(post)
deprecation_note
Assigner.mentioned_staff(post)
end
def self.publish_topic_tracking_state(topic, user_id)
deprecation_note
Assigner.publish_topic_tracking_state(topic, user_id)
end
def initialize(target, user)
self.class.deprecation_note
Assigner.new(target, user)
end
def self.deprecation_note
Discourse.deprecate("TopicAssigner class is deprecated, use Assigner", since: "2.8", drop_from: "2.9")
end
end

View File

@ -33,6 +33,7 @@ after_initialize do
require File.expand_path('../jobs/regular/remind_user.rb', __FILE__)
require File.expand_path('../jobs/regular/assign_notification.rb', __FILE__)
require File.expand_path('../jobs/regular/unassign_notification.rb', __FILE__)
require 'topic_assigner'
require 'assigner'
require 'pending_assigns_reminder'