Commit 3c3794f9 authored by Illya Klymov's avatar Illya Klymov

Restrict recovery regular check callout only to gitlab.com

Self-hosted instances might have specific configurations
which make this message confusing to end users
parent 982cb911
...@@ -61,6 +61,7 @@ module EE ...@@ -61,6 +61,7 @@ module EE
def render_account_recovery_regular_check def render_account_recovery_regular_check
return unless current_user && return unless current_user &&
::Gitlab.com? &&
3.months.ago > current_user.created_at && 3.months.ago > current_user.created_at &&
!user_dismissed?(ACCOUNT_RECOVERY_REGULAR_CHECK, 3.months.ago) !user_dismissed?(ACCOUNT_RECOVERY_REGULAR_CHECK, 3.months.ago)
......
---
title: Restrict prompt to check user account settings only to Gitlab.com
merge_request: 29672
author:
type: changed
...@@ -8,6 +8,7 @@ describe 'Account recovery regular check callout' do ...@@ -8,6 +8,7 @@ describe 'Account recovery regular check callout' do
let(:message) { "Please ensure your account's recovery settings are up to date." } let(:message) { "Please ensure your account's recovery settings are up to date." }
before do before do
allow(Gitlab).to receive(:com?) { true }
gitlab_sign_in(user) gitlab_sign_in(user)
end end
......
...@@ -295,18 +295,22 @@ describe EE::UserCalloutsHelper do ...@@ -295,18 +295,22 @@ describe EE::UserCalloutsHelper do
let(:old_user) { create(:user, created_at: 4.months.ago )} let(:old_user) { create(:user, created_at: 4.months.ago )}
let(:anonymous) { nil } let(:anonymous) { nil }
where(:kind_of_user, :dismissed_callout?, :should_render?) do where(:kind_of_user, :is_gitlab_com?, :dismissed_callout?, :should_render?) do
:anonymous | false | false :anonymous | false | false | false
:new_user | false | false :anonymous | true | false | false
:old_user | false | true :new_user | false | false | false
:old_user | true | false :new_user | true | false | false
:old_user | false | false | false
:old_user | true | false | true
:old_user | false | true | false
:old_user | true | true | false
end end
with_them do with_them do
before do before do
user = send(kind_of_user) user = send(kind_of_user)
allow(helper).to receive(:current_user).and_return(user) allow(helper).to receive(:current_user).and_return(user)
allow(Gitlab).to receive(:com?).and_return(is_gitlab_com?)
allow(user).to receive(:dismissed_callout?).and_return(dismissed_callout?) if user allow(user).to receive(:dismissed_callout?).and_return(dismissed_callout?) if user
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