Use `before_action` instead of `before_filter` for Rails 5.1 compatibility.

This commit is contained in:
Guo Xiang Tan 2017-09-04 10:44:32 +08:00
parent 1fa228b68c
commit 16c5607fa4
4 changed files with 8 additions and 8 deletions

View File

@ -56,7 +56,7 @@ module DiscourseChat
end end
def self.requires_provider(provider_name) def self.requires_provider(provider_name)
before_filter do before_action do
raise ProviderDisabled.new unless Provider.enabled_provider_names.include?(provider_name) raise ProviderDisabled.new unless Provider.enabled_provider_names.include?(provider_name)
end end
end end

View File

@ -2,9 +2,9 @@ module DiscourseChat::Provider::MattermostProvider
class MattermostCommandController < DiscourseChat::Provider::HookController class MattermostCommandController < DiscourseChat::Provider::HookController
requires_provider ::DiscourseChat::Provider::MattermostProvider::PROVIDER_NAME requires_provider ::DiscourseChat::Provider::MattermostProvider::PROVIDER_NAME
before_filter :mattermost_token_valid?, only: :command before_action :mattermost_token_valid?, only: :command
skip_before_filter :check_xhr, skip_before_action :check_xhr,
:preload_json, :preload_json,
:verify_authenticity_token, :verify_authenticity_token,
:redirect_to_login_if_required, :redirect_to_login_if_required,

View File

@ -2,10 +2,10 @@ module DiscourseChat::Provider::SlackProvider
class SlackCommandController < DiscourseChat::Provider::HookController class SlackCommandController < DiscourseChat::Provider::HookController
requires_provider ::DiscourseChat::Provider::SlackProvider::PROVIDER_NAME requires_provider ::DiscourseChat::Provider::SlackProvider::PROVIDER_NAME
before_filter :slack_token_valid?, only: :command before_action :slack_token_valid?, only: :command
before_filter :slack_payload_token_valid?, only: :interactive before_action :slack_payload_token_valid?, only: :interactive
skip_before_filter :check_xhr, skip_before_action :check_xhr,
:preload_json, :preload_json,
:verify_authenticity_token, :verify_authenticity_token,
:redirect_to_login_if_required, :redirect_to_login_if_required,

View File

@ -2,9 +2,9 @@ module DiscourseChat::Provider::TelegramProvider
class TelegramCommandController < DiscourseChat::Provider::HookController class TelegramCommandController < DiscourseChat::Provider::HookController
requires_provider ::DiscourseChat::Provider::TelegramProvider::PROVIDER_NAME requires_provider ::DiscourseChat::Provider::TelegramProvider::PROVIDER_NAME
before_filter :telegram_token_valid?, only: :command before_action :telegram_token_valid?, only: :command
skip_before_filter :check_xhr, skip_before_action :check_xhr,
:preload_json, :preload_json,
:verify_authenticity_token, :verify_authenticity_token,
:redirect_to_login_if_required, :redirect_to_login_if_required,