diff --git a/app/models/users/phone_number_validation.rb b/app/models/users/phone_number_validation.rb index ffb8d3a95a2de709b483678bdd538383d76d8613..420bfa74770f8b454278f9a910955d54a6b64b0e 100644 --- a/app/models/users/phone_number_validation.rb +++ b/app/models/users/phone_number_validation.rb @@ -69,8 +69,6 @@ def validated? end def sms_send_allowed_after - return unless Feature.enabled?(:sms_send_wait_time, user) - # first send is allowed anytime return if sms_send_count < 1 return unless sms_sent_at diff --git a/config/feature_flags/development/sms_send_wait_time.yml b/config/feature_flags/development/sms_send_wait_time.yml deleted file mode 100644 index e4cde3477caad37998a45cfd73756fd74dc4f506..0000000000000000000000000000000000000000 --- a/config/feature_flags/development/sms_send_wait_time.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: sms_send_wait_time -introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/137850 -rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/432975 -milestone: '16.8' -type: development -group: group::anti-abuse -default_enabled: false diff --git a/ee/app/services/phone_verification/users/send_verification_code_service.rb b/ee/app/services/phone_verification/users/send_verification_code_service.rb index ce062863d41a3ae38a087cc0ee9e85c5ece71f22..14e6c667ff38960794c221a8c60b3e470b9627c9 100644 --- a/ee/app/services/phone_verification/users/send_verification_code_service.rb +++ b/ee/app/services/phone_verification/users/send_verification_code_service.rb @@ -91,8 +91,6 @@ def error_in_params end def reset_sms_send_data - return unless Feature.enabled?(:sms_send_wait_time, user) - record.update!(sms_send_count: 0, sms_sent_at: nil) end @@ -171,17 +169,14 @@ def success(risk_result, send_code_result) log_limit_exceeded_event(:hard_phone_verification_transactions_limit) end - attrs = { telesign_reference_xid: send_code_result[:telesign_reference_xid] } - - if Feature.enabled?(:sms_send_wait_time, user) - last_sms_sent_today = record.sms_sent_at&.today? - sms_send_count = last_sms_sent_today ? record.sms_send_count + 1 : 1 + last_sms_sent_today = record.sms_sent_at&.today? + sms_send_count = last_sms_sent_today ? record.sms_send_count + 1 : 1 - attrs.merge!({ - sms_sent_at: Time.current, - sms_send_count: sms_send_count - }) - end + attrs = { + sms_sent_at: Time.current, + sms_send_count: sms_send_count, + telesign_reference_xid: send_code_result[:telesign_reference_xid] + } attrs[:risk_score] = risk_result[:risk_score] if Feature.enabled?(:telesign_intelligence, type: :ops) diff --git a/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb b/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb index e04de0d4b80df7ee2c8490bc8ac3ad3fc2925455..754d07f45ac083bb289f3f4966a0521f8c19575e 100644 --- a/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb +++ b/ee/spec/services/phone_verification/users/send_verification_code_service_spec.rb @@ -57,16 +57,6 @@ expect { service.execute }.to change { [record.reload.sms_send_count, record.reload.sms_sent_at] }.to([0, nil]) end - context 'when sms_send_wait_time feature flag is disabled' do - before do - stub_feature_flags(sms_send_wait_time: false) - end - - it 'does not reset sms_send_count and sms_sent_at' do - expect { service.execute }.not_to change { [record.reload.sms_send_count, record.reload.sms_sent_at] } - end - end - it 'returns an error', :aggregate_failures do response = service.execute @@ -376,19 +366,6 @@ end end - context 'when sms_send_wait_time feature flag is disabled' do - before do - stub_feature_flags(sms_send_wait_time: false) - end - - it 'does not update sms_send_count and sms_sent_at', :freeze_time, :aggregate_failures do - service.execute - record = user.phone_number_validation - expect(record.sms_send_count).to eq(0) - expect(record.sms_sent_at).to be_nil - end - end - context 'when send is allowed', :freeze_time do let_it_be(:record) do create(:phone_number_validation, user: user, sms_send_count: 1, sms_sent_at: Time.current) diff --git a/spec/models/users/phone_number_validation_spec.rb b/spec/models/users/phone_number_validation_spec.rb index eb73fc31dac5481ffcda25635b0377aed2a6c025..32f174a60c94d28f0d1dd7ed189267e6c2d5fbb1 100644 --- a/spec/models/users/phone_number_validation_spec.rb +++ b/spec/models/users/phone_number_validation_spec.rb @@ -262,16 +262,6 @@ it { is_expected.to be_nil } end - context 'when sms_send_wait_time feature flag is disabled' do - let_it_be(:record) { create(:phone_number_validation, sms_send_count: 1) } - - before do - stub_feature_flags(sms_send_wait_time: false) - end - - it { is_expected.to be_nil } - end - where(:attempt_number, :expected_delay) do 2 | 1.minute 3 | 3.minutes