Commit 4c5fbb42 authored by Dmitriy Zaporozhets (DZ)'s avatar Dmitriy Zaporozhets (DZ)

Merge branch...

Merge branch '337545-follow-up-from-update-copy-in-account-recovery-settings-global-alert' into 'master'

Update file names and method names after copy change

See merge request gitlab-org/gitlab!67466
parents 4ecc55da 57dea08c
...@@ -57,7 +57,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController ...@@ -57,7 +57,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
@codes = user.generate_otp_backup_codes! @codes = user.generate_otp_backup_codes!
end end
helpers.dismiss_account_recovery_regular_check helpers.dismiss_two_factor_auth_recovery_settings_check
render 'create' render 'create'
else else
...@@ -108,7 +108,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController ...@@ -108,7 +108,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
Users::UpdateService.new(current_user, user: current_user).execute! do |user| Users::UpdateService.new(current_user, user: current_user).execute! do |user|
@codes = user.generate_otp_backup_codes! @codes = user.generate_otp_backup_codes!
helpers.dismiss_account_recovery_regular_check helpers.dismiss_two_factor_auth_recovery_settings_check
end end
end end
......
...@@ -27,7 +27,7 @@ module UserCalloutsHelper ...@@ -27,7 +27,7 @@ module UserCalloutsHelper
def render_dashboard_ultimate_trial(user) def render_dashboard_ultimate_trial(user)
end end
def render_account_recovery_regular_check def render_two_factor_auth_recovery_settings_check
end end
def show_suggest_popover? def show_suggest_popover?
...@@ -53,7 +53,7 @@ module UserCalloutsHelper ...@@ -53,7 +53,7 @@ module UserCalloutsHelper
!user_dismissed?(REGISTRATION_ENABLED_CALLOUT) !user_dismissed?(REGISTRATION_ENABLED_CALLOUT)
end end
def dismiss_account_recovery_regular_check def dismiss_two_factor_auth_recovery_settings_check
end end
private private
......
...@@ -15,7 +15,7 @@ class UserCallout < ApplicationRecord ...@@ -15,7 +15,7 @@ class UserCallout < ApplicationRecord
suggest_popover_dismissed: 9, suggest_popover_dismissed: 9,
tabs_position_highlight: 10, tabs_position_highlight: 10,
threat_monitoring_info: 11, # EE-only 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 web_ide_alert_dismissed: 16, # no longer in use
active_user_count_threshold: 18, # EE-only active_user_count_threshold: 18, # EE-only
buy_pipeline_minutes_notification_dot: 19, # EE-only buy_pipeline_minutes_notification_dot: 19, # EE-only
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
= render "layouts/nav/classification_level_banner" = render "layouts/nav/classification_level_banner"
= yield :flash_message = yield :flash_message
= render "shared/service_ping_consent" = 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 "layouts/header/ee_subscribable_banner"
= render_if_exists "shared/namespace_storage_limit_alert" = render_if_exists "shared/namespace_storage_limit_alert"
= render_if_exists "shared/new_user_signups_cap_reached_alert" = render_if_exists "shared/new_user_signups_cap_reached_alert"
......
= render 'shared/global_alert', = render 'shared/global_alert',
variant: :warning, variant: :warning,
alert_class: 'js-recovery-settings-callout', 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 close_button_data: { testid: 'close-account-recovery-regular-check-callout' } do
.gl-alert-body .gl-alert-body
= s_('Profiles|Ensure you have two-factor authentication recovery codes stored in a safe place.') = 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. ...@@ -16029,7 +16029,6 @@ Name of the feature that the callout is for.
| Value | Description | | 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="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="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. | | <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. ...@@ -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="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_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="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="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="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. | | <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 ...@@ -4,7 +4,7 @@ module EE
module UserCalloutsHelper module UserCalloutsHelper
extend ::Gitlab::Utils::Override 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' ACTIVE_USER_COUNT_THRESHOLD = 'active_user_count_threshold'
GEO_ENABLE_HASHED_STORAGE = 'geo_enable_hashed_storage' GEO_ENABLE_HASHED_STORAGE = 'geo_enable_hashed_storage'
GEO_MIGRATE_HASHED_STORAGE = 'geo_migrate_hashed_storage' GEO_MIGRATE_HASHED_STORAGE = 'geo_migrate_hashed_storage'
...@@ -55,13 +55,13 @@ module EE ...@@ -55,13 +55,13 @@ module EE
render 'shared/ultimate_trial_callout_content' render 'shared/ultimate_trial_callout_content'
end end
def render_account_recovery_regular_check def render_two_factor_auth_recovery_settings_check
return unless current_user && return unless current_user &&
::Gitlab.com? && ::Gitlab.com? &&
current_user.two_factor_otp_enabled? && 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 end
def show_token_expiry_notification? def show_token_expiry_notification?
...@@ -95,10 +95,10 @@ module EE ...@@ -95,10 +95,10 @@ module EE
(namespace.group? && namespace.has_owner?(current_user.id)) || !namespace.group? (namespace.group? && namespace.has_owner?(current_user.id)) || !namespace.group?
end end
override :dismiss_account_recovery_regular_check override :dismiss_two_factor_auth_recovery_settings_check
def dismiss_account_recovery_regular_check def dismiss_two_factor_auth_recovery_settings_check
::Users::DismissUserCalloutService.new( ::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 ).execute
end end
......
...@@ -180,7 +180,7 @@ RSpec.describe EE::UserCalloutsHelper do ...@@ -180,7 +180,7 @@ RSpec.describe EE::UserCalloutsHelper do
end end
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_disabled) { create(:user) }
let(:user_two_factor_enabled) { create(:user, :two_factor) } let(:user_two_factor_enabled) { create(:user, :two_factor) }
let(:anonymous) { nil } let(:anonymous) { nil }
...@@ -206,12 +206,12 @@ RSpec.describe EE::UserCalloutsHelper do ...@@ -206,12 +206,12 @@ RSpec.describe EE::UserCalloutsHelper do
it do it do
if should_render? 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 else
expect(helper).not_to receive(:render) expect(helper).not_to receive(:render)
end end
helper.render_account_recovery_regular_check helper.render_two_factor_auth_recovery_settings_check
end end
end end
end end
...@@ -392,24 +392,24 @@ RSpec.describe EE::UserCalloutsHelper do ...@@ -392,24 +392,24 @@ RSpec.describe EE::UserCalloutsHelper do
end end
end end
describe '#dismiss_account_recovery_regular_check' do describe '#dismiss_two_factor_auth_recovery_settings_check' do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
before do before do
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
end end
it 'dismisses `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do it 'dismisses `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(::Users::DismissUserCalloutService) expect(::Users::DismissUserCalloutService)
.to receive(:new) .to receive(:new)
.with( .with(
container: nil, container: nil,
current_user: user, current_user: user,
params: { feature_name: UserCalloutsHelper::ACCOUNT_RECOVERY_REGULAR_CHECK } params: { feature_name: UserCalloutsHelper::TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK }
) )
.and_call_original .and_call_original
helper.dismiss_account_recovery_regular_check helper.dismiss_two_factor_auth_recovery_settings_check
end end
end end
end end
...@@ -70,8 +70,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do ...@@ -70,8 +70,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do
go go
end end
it 'dismisses the `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do it 'dismisses the `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_account_recovery_regular_check) expect(controller.helpers).to receive(:dismiss_two_factor_auth_recovery_settings_check)
go go
end end
...@@ -124,8 +124,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do ...@@ -124,8 +124,8 @@ RSpec.describe Profiles::TwoFactorAuthsController do
expect(user.otp_backup_codes).not_to be_empty expect(user.otp_backup_codes).not_to be_empty
end end
it 'dismisses the `ACCOUNT_RECOVERY_REGULAR_CHECK` callout' do it 'dismisses the `TWO_FACTOR_AUTH_RECOVERY_SETTINGS_CHECK` callout' do
expect(controller.helpers).to receive(:dismiss_account_recovery_regular_check) expect(controller.helpers).to receive(:dismiss_two_factor_auth_recovery_settings_check)
post :codes post :codes
end 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