DEV: Let's always give a drop_from param to deprecate (#14901)

DEV: Let’s always give a drop_from param to deprecate (#14901)

So that we know when deprecations can be removed in the future.

diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb
index 8bc8905..6fbb210 100644
--- a/app/controllers/groups_controller.rb
+++ b/app/controllers/groups_controller.rb
@@ -247,7 +247,7 @@ class GroupsController < ApplicationController
 
     dir = (params[:asc] && params[:asc].present?) ? 'ASC' : 'DESC'
     if params[:desc]
-      Discourse.deprecate(":desc is deprecated please use :asc instead", output_in_test: true)
+      Discourse.deprecate(":desc is deprecated please use :asc instead", output_in_test: true, drop_from: '2.9.0')
       dir = (params[:desc] && params[:desc].present?) ? 'DESC' : 'ASC'
     end
     order = ""
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb
index 0ffeaf6..0506310 100644
--- a/app/controllers/posts_controller.rb
+++ b/app/controllers/posts_controller.rb
@@ -776,7 +776,7 @@ class PostsController < ApplicationController
     result[:referrer] = request.env["HTTP_REFERER"]
 
     if recipients = result[:target_usernames]
-      Discourse.deprecate("`target_usernames` is deprecated, use `target_recipients` instead.", output_in_test: true)
+      Discourse.deprecate("`target_usernames` is deprecated, use `target_recipients` instead.", output_in_test: true, drop_from: '2.9.0')
     else
       recipients = result[:target_recipients]
     end
diff --git a/app/models/category.rb b/app/models/category.rb
index 9140247..ad5a662 100644
--- a/app/models/category.rb
+++ b/app/models/category.rb
@@ -747,7 +747,7 @@ class Category < ActiveRecord::Base
   end
 
   def url_with_id
-    Discourse.deprecate("Category#url_with_id is deprecated. Use `Category#url` instead.", output_in_test: true)
+    Discourse.deprecate("Category#url_with_id is deprecated. Use `Category#url` instead.", output_in_test: true, drop_from: '2.9.0')
 
     url
   end
diff --git a/app/models/post_action.rb b/app/models/post_action.rb
index c7d28f8..a26998a 100644
--- a/app/models/post_action.rb
+++ b/app/models/post_action.rb
@@ -103,7 +103,11 @@ class PostAction < ActiveRecord::Base
   end
 
   def self.act(created_by, post, post_action_type_id, opts = {})
-    Discourse.deprecate("PostAction.act is deprecated. Use `PostActionCreator` instead.", output_in_test: true)
+    Discourse.deprecate(
+      "PostAction.act is deprecated. Use `PostActionCreator` instead.",
+      output_in_test: true,
+      drop_from: '2.9.0',
+    )
 
     result = PostActionCreator.new(
       created_by,
@@ -131,7 +135,8 @@ class PostAction < ActiveRecord::Base
   def self.remove_act(user, post, post_action_type_id)
     Discourse.deprecate(
       "PostAction.remove_act is deprecated. Use `PostActionDestroyer` instead.",
-      output_in_test: true
+      output_in_test: true,
+      drop_from: '2.9.0',
     )
 
     PostActionDestroyer.new(user, post, post_action_type_id).perform
diff --git a/app/models/report.rb b/app/models/report.rb
index b0f97d7..4bd1856 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -107,7 +107,7 @@ class Report
   def add_filter(name, options = {})
     if options[:type].blank?
       options[:type] = name
-      Discourse.deprecate("#{name} filter should define a `:type` option. Temporarily setting type to #{name}.")
+      Discourse.deprecate("#{name} filter should define a `:type` option. Temporarily setting type to #{name}.", drop_from: '2.9.0')
     end
 
     available_filters[name] = options
diff --git a/app/models/reviewable.rb b/app/models/reviewable.rb
index bff1c63..08d0264 100644
--- a/app/models/reviewable.rb
+++ b/app/models/reviewable.rb
@@ -402,7 +402,8 @@ class Reviewable < ActiveRecord::Base
   def post_options
     Discourse.deprecate(
       "Reviewable#post_options is deprecated. Please use #payload instead.",
-      output_in_test: true
+      output_in_test: true,
+      drop_from: '2.9.0',
     )
   end
 
diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb
index 89a5e92..8f0b251 100644
--- a/app/models/site_setting.rb
+++ b/app/models/site_setting.rb
@@ -90,7 +90,7 @@ class SiteSetting < ActiveRecord::Base
   end
 
   def self.queue_jobs=(val)
-    Discourse.deprecate("queue_jobs is deprecated. Please use Jobs.run_immediately! instead")
+    Discourse.deprecate("queue_jobs is deprecated. Please use Jobs.run_immediately! instead", drop_from: '2.9.0')
     val ? Jobs.run_later! : Jobs.run_immediately!
   end
 
diff --git a/lib/admin_user_index_query.rb b/lib/admin_user_index_query.rb
index 8780ace..5303077 100644
--- a/lib/admin_user_index_query.rb
+++ b/lib/admin_user_index_query.rb
@@ -37,7 +37,7 @@ class AdminUserIndexQuery
   end
 
   def custom_direction
-    Discourse.deprecate(":ascending is deprecated please use :asc instead", output_in_test: true) if params[:ascending]
+    Discourse.deprecate(":ascending is deprecated please use :asc instead", output_in_test: true, drop_from: '2.9.0') if params[:ascending]
     asc = params[:asc] || params[:ascending]
     asc.present? && asc ? "ASC" : "DESC"
   end
diff --git a/lib/auth/auth_provider.rb b/lib/auth/auth_provider.rb
index 50bb76c..09f0f5f 100644
--- a/lib/auth/auth_provider.rb
+++ b/lib/auth/auth_provider.rb
@@ -16,24 +16,24 @@ class Auth::AuthProvider
   attr_accessor(*auth_attributes)
 
   def enabled_setting=(val)
-    Discourse.deprecate("(#{authenticator.name}) enabled_setting is deprecated. Please define authenticator.enabled? instead")
+    Discourse.deprecate("(#{authenticator.name}) enabled_setting is deprecated. Please define authenticator.enabled? instead", drop_from: '2.9.0')
     @enabled_setting = val
   end
 
   def background_color=(val)
-    Discourse.deprecate("(#{authenticator.name}) background_color is no longer functional. Please use CSS instead")
+    Discourse.deprecate("(#{authenticator.name}) background_color is no longer functional. Please use CSS instead", drop_from: '2.9.0')
   end
 
   def full_screen_login=(val)
-    Discourse.deprecate("(#{authenticator.name}) full_screen_login is now forced. The full_screen_login parameter can be removed from the auth_provider.")
+    Discourse.deprecate("(#{authenticator.name}) full_screen_login is now forced. The full_screen_login parameter can be removed from the auth_provider.", drop_from: '2.9.0')
   end
 
   def full_screen_login_setting=(val)
-    Discourse.deprecate("(#{authenticator.name}) full_screen_login is now forced. The full_screen_login_setting parameter can be removed from the auth_provider.")
+    Discourse.deprecate("(#{authenticator.name}) full_screen_login is now forced. The full_screen_login_setting parameter can be removed from the auth_provider.", drop_from: '2.9.0')
   end
 
   def message=(val)
-    Discourse.deprecate("(#{authenticator.name}) message is no longer used because all logins are full screen. It should be removed from the auth_provider")
+    Discourse.deprecate("(#{authenticator.name}) message is no longer used because all logins are full screen. It should be removed from the auth_provider", drop_from: '2.9.0')
   end
 
   def name
diff --git a/lib/auth/default_current_user_provider.rb b/lib/auth/default_current_user_provider.rb
index 571bad9..a35d40a 100644
--- a/lib/auth/default_current_user_provider.rb
+++ b/lib/auth/default_current_user_provider.rb
@@ -383,7 +383,7 @@ class Auth::DefaultCurrentUserProvider
 
     limit = GlobalSetting.max_admin_api_reqs_per_minute.to_i
     if GlobalSetting.respond_to?(:max_admin_api_reqs_per_key_per_minute)
-      Discourse.deprecate("DISCOURSE_MAX_ADMIN_API_REQS_PER_KEY_PER_MINUTE is deprecated. Please use DISCOURSE_MAX_ADMIN_API_REQS_PER_MINUTE")
+      Discourse.deprecate("DISCOURSE_MAX_ADMIN_API_REQS_PER_KEY_PER_MINUTE is deprecated. Please use DISCOURSE_MAX_ADMIN_API_REQS_PER_MINUTE", drop_from: '2.9.0')
       limit = [ GlobalSetting.max_admin_api_reqs_per_key_per_minute.to_i, limit].max
     end
 
diff --git a/lib/freedom_patches/active_record_base.rb b/lib/freedom_patches/active_record_base.rb

[... diff too long, it was truncated ...]

GitHub sha: e7c0bbb9c052ee9f570e9bdcade212f3be79099c

This commit appears in #14901 which was approved by Falco. It was merged by danielwaterworth.