Commit 81ba6d88 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'sh-add-cc-status-admin-page' into 'master'

Display credit card status in /admin/users/:id page

See merge request gitlab-org/gitlab!62803
parents 8d432f62 7914eeff
......@@ -59,6 +59,7 @@
= _('Disabled')
= render_if_exists 'admin/namespace_plan_info', namespace: @user.namespace
= render_if_exists 'admin/users/credit_card_info', user: @user
%li
%span.light= _('External User:')
......
- return unless Gitlab.com?
%li#credit-card-status
- if user.credit_card_validated_at
%span.light= _('Credit card validated at:')
%strong
= user.credit_card_validated_at.to_s(:medium)
- else
%span.light= _('Credit card validated:')
%strong
= _('No')
# frozen_string_literal: true
FactoryBot.modify do
factory :credit_card_validation do
user
credit_card_validated_at { Time.current }
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/users/show.html.haml' do
let_it_be(:user) { create(:user) }
let(:page) { Nokogiri::HTML.parse(rendered) }
let(:status) { page.at('#credit-card-status')&.text }
before do
assign(:user, user)
end
it 'does not include credit card validation status' do
render
expect(rendered).not_to include('Credit card validated')
expect(status).to be_nil
end
context 'Gitlab.com' do
before do
allow(::Gitlab).to receive(:com?).and_return(true)
end
it 'includes credit card validation status' do
render
expect(status).to match /Credit card validated:\s+No/
end
context 'when user is validated' do
let!(:validation) { create(:credit_card_validation, user: user) }
it 'includes credit card validation status' do
render
expect(status).to include 'Credit card validated at:'
end
end
end
end
......@@ -9681,6 +9681,12 @@ msgstr ""
msgid "CredentialsInventory|SSH Keys"
msgstr ""
msgid "Credit card validated at:"
msgstr ""
msgid "Credit card validated:"
msgstr ""
msgid "Critical vulnerabilities present"
msgstr ""
......
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