Commit 57dea08c authored by Peter Hegman's avatar Peter Hegman Committed by Dmitriy Zaporozhets (DZ)

Update file names and method names after copy change

parent 2f7aba84
......@@ -57,7 +57,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
@codes = user.generate_otp_backup_codes!
end
helpers.dismiss_account_recovery_regular_check
helpers.dismiss_two_factor_auth_recovery_settings_check
render 'create'
else
......@@ -108,7 +108,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
Users::UpdateService.new(current_user, user: current_user).execute! do |user|
@codes = user.generate_otp_backup_codes!
helpers.dismiss_account_recovery_regular_check
helpers.dismiss_two_factor_auth_recovery_settings_check
end
end
......
......@@ -27,7 +27,7 @@ module UserCalloutsHelper
def render_dashboard_ultimate_trial(user)
end
def render_account_recovery_regular_check
def render_two_factor_auth_recovery_settings_check
end
def show_suggest_popover?
......@@ -53,7 +53,7 @@ module UserCalloutsHelper
!user_dismissed?(REGISTRATION_ENABLED_CALLOUT)
end
def dismiss_account_recovery_regular_check
def dismiss_two_factor_auth_recovery_settings_check
end
private
......
......@@ -15,7 +15,7 @@ class UserCallout < ApplicationRecord
suggest_popover_dismissed: 9,
tabs_position_highlight: 10,
threat_monitoring_info: 11, # EE-only
account_recovery_regular_check: 12, # EE-only
two_factor_auth_recovery_settings_check: 12, # EE-only
web_ide_alert_dismissed: 16, # no longer in use
active_user_count_threshold: 18, # EE-only
buy_pipeline_minutes_notification_dot: 19, # EE-only
......
......@@ -14,7 +14,7 @@
= render "layouts/nav/classification_level_banner"
= yield :flash_message
= render "shared/service_ping_consent"
= render_account_recovery_regular_check
= render_two_factor_auth_recovery_settings_check
= render_if_exists "layouts/header/ee_subscribable_banner"
= render_if_exists "shared/namespace_storage_limit_alert"
= render_if_exists "shared/new_user_signups_cap_reached_alert"
......
= render 'shared/global_alert',
variant: :warning,
alert_class: 'js-recovery-settings-callout',
alert_data: { feature_id: 'account_recovery_regular_check', dismiss_endpoint: user_callouts_path, defer_links: 'true' },
alert_data: { feature_id: UserCalloutsHelper::TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK, dismiss_endpoint: user_callouts_path, defer_links: 'true' },
close_button_data: { testid: 'close-account-recovery-regular-check-callout' } do
.gl-alert-body
= s_('Profiles|Ensure you have two-factor authentication recovery codes stored in a safe place.')
......
......@@ -16029,7 +16029,6 @@ Name of the feature that the callout is for.
| Value | Description |
| ----- | ----------- |
| <a id="usercalloutfeaturenameenumaccount_recovery_regular_check"></a>`ACCOUNT_RECOVERY_REGULAR_CHECK` | Callout feature name for account_recovery_regular_check. |
| <a id="usercalloutfeaturenameenumactive_user_count_threshold"></a>`ACTIVE_USER_COUNT_THRESHOLD` | Callout feature name for active_user_count_threshold. |
| <a id="usercalloutfeaturenameenumbuy_pipeline_minutes_notification_dot"></a>`BUY_PIPELINE_MINUTES_NOTIFICATION_DOT` | Callout feature name for buy_pipeline_minutes_notification_dot. |
| <a id="usercalloutfeaturenameenumcanary_deployment"></a>`CANARY_DEPLOYMENT` | Callout feature name for canary_deployment. |
......@@ -16058,6 +16057,7 @@ Name of the feature that the callout is for.
| <a id="usercalloutfeaturenameenumthreat_monitoring_info"></a>`THREAT_MONITORING_INFO` | Callout feature name for threat_monitoring_info. |
| <a id="usercalloutfeaturenameenumtrial_status_reminder_d14"></a>`TRIAL_STATUS_REMINDER_D14` | Callout feature name for trial_status_reminder_d14. |
| <a id="usercalloutfeaturenameenumtrial_status_reminder_d3"></a>`TRIAL_STATUS_REMINDER_D3` | Callout feature name for trial_status_reminder_d3. |
| <a id="usercalloutfeaturenameenumtwo_factor_auth_recovery_settings_check"></a>`TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` | Callout feature name for two_factor_auth_recovery_settings_check. |
| <a id="usercalloutfeaturenameenumultimate_trial"></a>`ULTIMATE_TRIAL` | Callout feature name for ultimate_trial. |
| <a id="usercalloutfeaturenameenumunfinished_tag_cleanup_callout"></a>`UNFINISHED_TAG_CLEANUP_CALLOUT` | Callout feature name for unfinished_tag_cleanup_callout. |
| <a id="usercalloutfeaturenameenumweb_ide_alert_dismissed"></a>`WEB_IDE_ALERT_DISMISSED` | Callout feature name for web_ide_alert_dismissed. |
......
......@@ -4,7 +4,7 @@ module EE
module UserCalloutsHelper
extend ::Gitlab::Utils::Override
ACCOUNT_RECOVERY_REGULAR_CHECK = 'account_recovery_regular_check'
TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK = 'two_factor_auth_recovery_settings_check'
ACTIVE_USER_COUNT_THRESHOLD = 'active_user_count_threshold'
GEO_ENABLE_HASHED_STORAGE = 'geo_enable_hashed_storage'
GEO_MIGRATE_HASHED_STORAGE = 'geo_migrate_hashed_storage'
......@@ -55,13 +55,13 @@ module EE
render 'shared/ultimate_trial_callout_content'
end
def render_account_recovery_regular_check
def render_two_factor_auth_recovery_settings_check
return unless current_user &&
::Gitlab.com? &&
current_user.two_factor_otp_enabled? &&
!user_dismissed?(ACCOUNT_RECOVERY_REGULAR_CHECK, 3.months.ago)
!user_dismissed?(TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK, 3.months.ago)
render 'shared/check_recovery_settings'
render 'shared/two_factor_auth_recovery_settings_check'
end
def show_token_expiry_notification?
......@@ -95,10 +95,10 @@ module EE
(namespace.group? && namespace.has_owner?(current_user.id)) || !namespace.group?
end
override :dismiss_account_recovery_regular_check
def dismiss_account_recovery_regular_check
override :dismiss_two_factor_auth_recovery_settings_check
def dismiss_two_factor_auth_recovery_settings_check
::Users::DismissUserCalloutService.new(
container: nil, current_user: current_user, params: { feature_name: ACCOUNT_RECOVERY_REGULAR_CHECK }
container: nil, current_user: current_user, params: { feature_name: TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK }
).execute
end
......
......@@ -180,7 +180,7 @@ RSpec.describe EE::UserCalloutsHelper do
end
end
describe '#render_account_recovery_regular_check' do
describe '#render_two_factor_auth_recovery_settings_check' do
let(:user_two_factor_disabled) { create(:user) }
let(:user_two_factor_enabled) { create(:user, :two_factor) }
let(:anonymous) { nil }
......@@ -206,12 +206,12 @@ RSpec.describe EE::UserCalloutsHelper do
it do
if should_render?
expect(helper).to receive(:render).with('shared/check_recovery_settings')
expect(helper).to receive(:render).with('shared/two_factor_auth_recovery_settings_check')
else
expect(helper).not_to receive(:render)
end
helper.render_account_recovery_regular_check
helper.render_two_factor_auth_recovery_settings_check
end
end
end
......@@ -392,24 +392,24 @@ RSpec.describe EE::UserCalloutsHelper do
end
end
describe '#dismiss_account_recovery_regular_check' do
describe '#dismiss_two_factor_auth_recovery_settings_check' do
let_it_be(:user) { create(:user) }
before do
allow(helper).to receive(:current_user).and_return(user)
end
it 'dismisses `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do
it 'dismisses `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(::Users::DismissUserCalloutService)
.to receive(:new)
.with(
container: nil,
current_user: user,
params: { feature_name: UserCalloutsHelper::ACCOUNT_RECOVERY_REGULAR_CHECK }
params: { feature_name: UserCalloutsHelper::TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK }
)
.and_call_original
helper.dismiss_account_recovery_regular_check
helper.dismiss_two_factor_auth_recovery_settings_check
end
end
end
......@@ -70,8 +70,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do
go
end
it 'dismisses the `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_account_recovery_regular_check)
it 'dismisses the `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_two_factor_auth_recovery_settings_check)
go
end
......@@ -124,8 +124,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do
expect(user.otp_backup_codes).not_to be_empty
end
it 'dismisses the `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_account_recovery_regular_check)
it 'dismisses the `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_two_factor_auth_recovery_settings_check)
post :codes
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment