A platform for community discussion. Free, open, simple.
DEV: Remove deprecated AuthProvider#enabled_setting= (#27081)
Ted Johansson32aaf2e8d340
diff --git a/lib/auth/auth_provider.rb b/lib/auth/auth_provider.rbindex 20e0e6cfbcd..ab79626b11b 100644--- a/lib/auth/auth_provider.rb+++ b/lib/auth/auth_provider.rb@@ -17,7 +17,6 @@ class Auth::AuthProviderframe_heightpretty_name_settingtitle_setting- enabled_settingfull_screen_loginfull_screen_login_settingcustom_url@@ -28,14 +27,6 @@ class Auth::AuthProviderattr_accessor(*auth_attributes)- def enabled_setting=(val)- 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",diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rbindex 76ed4548017..a29e5b13ab5 100644--- a/lib/plugin/instance.rb+++ b/lib/plugin/instance.rb@@ -791,25 +791,6 @@ class Plugin::Instanceprovider.public_send("#{sym}=", opts.delete(sym)) if opts.has_key?(sym)end- begin- provider.authenticator.enabled?- rescue NotImplementedError- provider- .authenticator- .define_singleton_method(:enabled?) do- Discourse.deprecate(- "#{provider.authenticator.class.name} should define an `enabled?` function. Patching for now.",- drop_from: "2.9.0",- )- return SiteSetting.get(provider.enabled_setting) if provider.enabled_setting- Discourse.deprecate(- "#{provider.authenticator.class.name} has not defined an enabled_setting. Defaulting to true.",- drop_from: "2.9.0",- )- true- end- end-DiscoursePluginRegistry.register_auth_provider(provider)endenddiff --git a/spec/lib/plugin/instance_spec.rb b/spec/lib/plugin/instance_spec.rbindex 7c8050fb32c..bd72cfc57b0 100644--- a/spec/lib/plugin/instance_spec.rb+++ b/spec/lib/plugin/instance_spec.rb@@ -324,49 +324,6 @@ TEXTendend- it "patches the enabled? function for auth_providers if not defined" do- SimpleAuthenticator =- Class.new(Auth::Authenticator) do- def name- "my_authenticator"- end- end-- plugin = Plugin::Instance.new-- # lets piggy back on another boolean setting, so we don't dirty our SiteSetting object- SiteSetting.enable_badges = false-- # No enabled_site_setting- authenticator = SimpleAuthenticator.new- plugin.auth_provider(authenticator: authenticator)- plugin.notify_after_initialize- expect(authenticator.enabled?).to eq(true)-- # With enabled site setting- plugin = Plugin::Instance.new- authenticator = SimpleAuthenticator.new- plugin.auth_provider(enabled_setting: "enable_badges", authenticator: authenticator)- plugin.notify_after_initialize- expect(authenticator.enabled?).to eq(false)-- # Defines own method- plugin = Plugin::Instance.new-- SiteSetting.enable_badges = true- authenticator =- Class- .new(SimpleAuthenticator) do- def enabled?- false- end- end- .new- plugin.auth_provider(enabled_setting: "enable_badges", authenticator: authenticator)- plugin.notify_after_initialize- expect(authenticator.enabled?).to eq(false)- end-describe "#activate!" dobefore do# lets piggy back on another boolean setting, so we don't dirty our SiteSetting objectdiff --git a/spec/requests/omniauth_callbacks_controller_spec.rb b/spec/requests/omniauth_callbacks_controller_spec.rbindex e9dbb7f1587..a69a2c6845a 100644--- a/spec/requests/omniauth_callbacks_controller_spec.rb+++ b/spec/requests/omniauth_callbacks_controller_spec.rb@@ -50,7 +50,6 @@ RSpec.describe Users::OmniauthCallbacksController doend.new- provider.enabled_setting = "ubuntu_login_enabled"providerend