Commit 12e3dfbe authored by Jiaan Louw's avatar Jiaan Louw Committed by Albert Salim

Remove vue_admin_users feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

parent f2d63afe
...@@ -107,6 +107,7 @@ export default { ...@@ -107,6 +107,7 @@ export default {
:items="users" :items="users"
:fields="$options.fields" :fields="$options.fields"
:empty-text="s__('AdminUsers|No users found')" :empty-text="s__('AdminUsers|No users found')"
data-qa-selector="user_row_content"
show-empty show-empty
stacked="md" stacked="md"
:tbody-tr-attr="{ 'data-qa-selector': 'user_row_content' }" :tbody-tr-attr="{ 'data-qa-selector': 'user_row_content' }"
......
.gl-responsive-table-row{ role: 'row', data: { qa_selector: 'user_row_content' } }
.table-section.section-40
.table-mobile-header{ role: 'rowheader' }
= _('Name')
.table-mobile-content
= render 'user_detail', user: user
.table-section.section-10
.table-mobile-header{ role: 'rowheader' }
= _('Projects')
.table-mobile-content.gl-str-truncated{ data: { testid: "user-project-count-#{user.id}" } }
= user.authorized_projects.length
.table-section.section-15
.table-mobile-header{ role: 'rowheader' }
= _('Created on')
.table-mobile-content
= l(user.created_at.to_date, format: :admin)
.table-section.section-15
.table-mobile-header{ role: 'rowheader' }
= _('Last activity')
.table-mobile-content
= user.last_activity_on.nil? ? _('Never') : l(user.last_activity_on, format: :admin)
- unless user.internal?
.table-section.section-20.table-button-footer
.table-action-buttons{ data: { testid: "user-actions-#{user.id}" } }
= link_to _('Edit'), edit_admin_user_path(user), class: 'btn gl-button btn-default'
- unless user == current_user
%button.dropdown-new.btn.gl-button.btn-default{ type: 'button', data: { testid: "dropdown-toggle", toggle: 'dropdown' } }
= sprite_icon('settings')
= sprite_icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right
%li.dropdown-header
= _('Settings')
%li
- if user.ldap_blocked?
%span.small
= s_('AdminUsers|Cannot unblock LDAP blocked users')
- elsif user.blocked?
- if user.blocked_pending_approval?
= link_to s_('AdminUsers|Approve'), approve_admin_user_path(user), method: :put
= link_to s_('AdminUsers|Reject'), reject_admin_user_path(user), method: :delete
- else
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_unblock_data(user) }
= s_('AdminUsers|Unblock')
- else
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_block_data(user, user_block_effects) }
= s_('AdminUsers|Block')
- if user.can_be_deactivated?
%li
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_deactivation_data(user, user_deactivation_effects) }
= s_('AdminUsers|Deactivate')
- elsif user.deactivated?
%li
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_activation_data(user) }
= s_('AdminUsers|Activate')
- if user.access_locked?
%li
= link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') }
- if can?(current_user, :destroy_user, user) && !user.blocked_pending_approval?
%li.divider
- if user.can_be_removed?
%li
%button.js-delete-user-modal-button.gl-button.btn.btn-danger-tertiary{ data: { 'gl-modal-action': 'delete',
delete_user_url: admin_user_path(user),
block_user_url: block_admin_user_path(user),
username: sanitize_name(user.name) } }
= s_('AdminUsers|Delete user')
%li
%button.js-delete-user-modal-button.gl-button.btn.btn-danger-tertiary{ data: { 'gl-modal-action': 'delete-with-contributions',
delete_user_url: admin_user_path(user, hard_delete: true),
block_user_url: block_admin_user_path(user),
username: sanitize_name(user.name) } }
= s_('AdminUsers|Delete user and contributions')
...@@ -73,20 +73,9 @@ ...@@ -73,20 +73,9 @@
= link_to admin_users_path(sort: value, filter: params[:filter], search_query: params[:search_query]) do = link_to admin_users_path(sort: value, filter: params[:filter], search_query: params[:search_query]) do
= title = title
- if Feature.enabled?(:vue_admin_users, default_enabled: :yaml) #js-admin-users-app{ data: admin_users_data_attributes(@users) }
#js-admin-users-app{ data: admin_users_data_attributes(@users) }
.gl-spinner-container.gl-my-7 .gl-spinner-container.gl-my-7
%span.gl-vertical-align-bottom.gl-spinner.gl-spinner-dark.gl-spinner-lg{ aria: { label: _('Loading') } } %span.gl-vertical-align-bottom.gl-spinner.gl-spinner-dark.gl-spinner-lg{ aria: { label: _('Loading') } }
- elsif @users.empty?
.nothing-here-block.border-top-0
= s_('AdminUsers|No users found')
- else
.table-holder
.thead-white.text-nowrap.gl-responsive-table-row.table-row-header{ role: 'row' }
- user_table_headers.each do |header|
.table-section{ class: header[:section_class_name], role: 'rowheader' }= header[:header_text]
= render partial: 'admin/users/user', collection: @users
= paginate_collection @users = paginate_collection @users
......
---
name: vue_admin_users
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48922
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/290737
milestone: '13.7'
type: development
group: group::compliance
default_enabled: true
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe "Admin::Users" do RSpec.describe "Admin::Users", :js do
let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') } let_it_be(:user) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') }
let_it_be(:current_user) { create(:admin) } let_it_be(:current_user) { create(:admin) }
...@@ -11,12 +11,6 @@ RSpec.describe "Admin::Users" do ...@@ -11,12 +11,6 @@ RSpec.describe "Admin::Users" do
gitlab_enable_admin_mode_sign_in(current_user) gitlab_enable_admin_mode_sign_in(current_user)
end end
[true, false].each do |vue_admin_users|
context "with vue_admin_users feature flag set to #{vue_admin_users}", js: vue_admin_users do
before do
stub_feature_flags(vue_admin_users: vue_admin_users)
end
describe 'GET /admin/users' do describe 'GET /admin/users' do
describe 'send emails to users' do describe 'send emails to users' do
context 'when `send_emails_from_admin_area` feature is enabled' do context 'when `send_emails_from_admin_area` feature is enabled' do
...@@ -177,6 +171,4 @@ RSpec.describe "Admin::Users" do ...@@ -177,6 +171,4 @@ RSpec.describe "Admin::Users" do
end end
end end
end end
end
end
end end
...@@ -84,8 +84,8 @@ tests = [ ...@@ -84,8 +84,8 @@ tests = [
{ {
explanation: 'FOSS views should map to respective spec', explanation: 'FOSS views should map to respective spec',
source: 'app/views/admin/users/_user.html.haml', source: 'app/views/admin/dashboard/index.html.haml',
expected: ['spec/views/admin/users/_user.html.haml_spec.rb'] expected: ['spec/views/admin/dashboard/index.html.haml_spec.rb']
}, },
{ {
......
...@@ -356,13 +356,7 @@ RSpec.describe 'Admin::Users::User' do ...@@ -356,13 +356,7 @@ RSpec.describe 'Admin::Users::User' do
end end
end end
[true, false].each do |vue_admin_users| describe 'GET /admin/users', :js do
context "with vue_admin_users feature flag set to #{vue_admin_users}", js: vue_admin_users do
before do
stub_feature_flags(vue_admin_users: vue_admin_users)
end
describe 'GET /admin/users' do
context 'user pending approval' do context 'user pending approval' do
it 'shows user info', :aggregate_failures do it 'shows user info', :aggregate_failures do
user = create(:user, :blocked_pending_approval) user = create(:user, :blocked_pending_approval)
...@@ -378,6 +372,4 @@ RSpec.describe 'Admin::Users::User' do ...@@ -378,6 +372,4 @@ RSpec.describe 'Admin::Users::User' do
end end
end end
end end
end
end
end end
...@@ -11,13 +11,7 @@ RSpec.describe 'Admin::Users' do ...@@ -11,13 +11,7 @@ RSpec.describe 'Admin::Users' do
gitlab_enable_admin_mode_sign_in(current_user) gitlab_enable_admin_mode_sign_in(current_user)
end end
[true, false].each do |vue_admin_users| describe 'GET /admin/users', :js do
context "with vue_admin_users feature flag set to #{vue_admin_users}", js: vue_admin_users do
before do
stub_feature_flags(vue_admin_users: vue_admin_users)
end
describe 'GET /admin/users' do
before do before do
visit admin_users_path visit admin_users_path
end end
...@@ -85,7 +79,6 @@ RSpec.describe 'Admin::Users' do ...@@ -85,7 +79,6 @@ RSpec.describe 'Admin::Users' do
expect(page).to have_link('2FA Disabled', href: admin_users_path(filter: 'two_factor_disabled')) expect(page).to have_link('2FA Disabled', href: admin_users_path(filter: 'two_factor_disabled'))
expect(page).to have_link('External', href: admin_users_path(filter: 'external')) expect(page).to have_link('External', href: admin_users_path(filter: 'external'))
expect(page).to have_link('Blocked', href: admin_users_path(filter: 'blocked')) expect(page).to have_link('Blocked', href: admin_users_path(filter: 'blocked'))
expect(page).to have_link('Banned', href: admin_users_path(filter: 'banned'))
expect(page).to have_link('Deactivated', href: admin_users_path(filter: 'deactivated')) expect(page).to have_link('Deactivated', href: admin_users_path(filter: 'deactivated'))
expect(page).to have_link('Without projects', href: admin_users_path(filter: 'wop')) expect(page).to have_link('Without projects', href: admin_users_path(filter: 'wop'))
end end
...@@ -297,6 +290,22 @@ RSpec.describe 'Admin::Users' do ...@@ -297,6 +290,22 @@ RSpec.describe 'Admin::Users' do
expect(page).not_to have_content(user.email) expect(page).not_to have_content(user.email)
end end
end end
describe 'internal users' do
context 'when showing a `Ghost User`' do
let_it_be(:ghost_user) { create(:user, :ghost) }
it 'does not render actions dropdown' do
expect(page).not_to have_css("[data-testid='user-actions-#{ghost_user.id}'] [data-testid='dropdown-toggle']")
end
end
context 'when showing a `Bot User`' do
let_it_be(:bot_user) { create(:user, user_type: :alert_bot) }
it 'does not render actions dropdown' do
expect(page).not_to have_css("[data-testid='user-actions-#{bot_user.id}'] [data-testid='dropdown-toggle']")
end
end end
end end
end end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/users/_user.html.haml' do
before do
allow(view).to receive(:user).and_return(user)
end
context 'internal users' do
context 'when showing a `Ghost User`' do
let(:user) { create(:user, :ghost) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
context 'when showing a `Bot User`' do
let(:user) { create(:user, user_type: :alert_bot) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
context 'when showing a `Migration User`' do
let(:user) { create(:user, user_type: :migration_bot) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
end
context 'when showing an external user' do
let(:user) { create(:user) }
it 'renders action buttons' do
render
expect(rendered).to have_selector('.table-action-buttons')
end
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