replace alias_method by super

pull/6827/head
Jens Ulferts 7 years ago
parent a8c93f32bf
commit dcc298ff06
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 11
      lib/open_project/two_factor_authentication/patches/users_helper_patch.rb

@ -2,21 +2,16 @@ module OpenProject::TwoFactorAuthentication::Patches
module UsersHelperPatch
def self.included(base) # :nodoc:
base.prepend(InstanceMethods)
base.class_eval do
alias_method :user_settings_tabs_without_2fa, :user_settings_tabs
alias_method :user_settings_tabs, :user_settings_tabs_with_2fa
end
end
module InstanceMethods
# Adds a 2FA tab to the user administration page
def user_settings_tabs_with_2fa
def user_settings_tabs
# Core defined data
if OpenProject::TwoFactorAuthentication::TokenStrategyManager.enabled?
user_settings_tabs_without_2fa + [{ name: 'two_factor_authentication', partial: 'users/two_factor_authentication', label: 'two_factor_authentication.label_two_factor_authentication' }]
super + [{ name: 'two_factor_authentication', partial: 'users/two_factor_authentication', label: 'two_factor_authentication.label_two_factor_authentication' }]
else
user_settings_tabs_without_2fa
super
end
end
end

Loading…
Cancel
Save