diff options
Diffstat (limited to 'app/views')
-rw-r--r-- | app/views/admin/users/_head.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/users/_modals.html.haml | 30 | ||||
-rw-r--r-- | app/views/admin/users/_user.html.haml | 35 | ||||
-rw-r--r-- | app/views/admin/users/_user_activation_effects.html.haml | 6 | ||||
-rw-r--r-- | app/views/admin/users/_user_block_effects.html.haml | 11 | ||||
-rw-r--r-- | app/views/admin/users/_user_deactivation_effects.html.haml | 16 | ||||
-rw-r--r-- | app/views/admin/users/index.html.haml | 7 | ||||
-rw-r--r-- | app/views/admin/users/show.html.haml | 48 |
8 files changed, 124 insertions, 31 deletions
diff --git a/app/views/admin/users/_head.html.haml b/app/views/admin/users/_head.html.haml index b53b2019a97..a218885a00e 100644 --- a/app/views/admin/users/_head.html.haml +++ b/app/views/admin/users/_head.html.haml @@ -6,6 +6,8 @@ %span.cred (Internal) - if @user.admin %span.cred (Admin) + - if @user.deactivated? + %span.cred (Deactivated) = render_if_exists 'admin/users/audtior_user_badge' .float-right diff --git a/app/views/admin/users/_modals.html.haml b/app/views/admin/users/_modals.html.haml new file mode 100644 index 00000000000..eaec6d69f5a --- /dev/null +++ b/app/views/admin/users/_modals.html.haml @@ -0,0 +1,30 @@ +#user-modal +#modal-texts.hidden{ "hidden": true, "aria-hidden": true } + %div{ data: { modal: "deactivate", + title: s_("AdminUsers|Deactivate User %{username}?"), + action: s_("AdminUsers|Deactivate") } } + = render partial: 'admin/users/user_deactivation_effects' + + %div{ data: { modal: "block", + title: s_("AdminUsers|Block user %{username}?"), + action: s_("AdminUsers|Block") } } + = render partial: 'admin/users/user_block_effects' + + %div{ data: { modal: "delete", + title: s_("AdminUsers|Delete User %{username}?"), + action: s_('AdminUsers|Delete user'), + 'secondary-action': s_('AdminUsers|Block user') } } + = s_('AdminUsers|You are about to permanently delete the user %{username}. Issues, merge requests, + and groups linked to them will be transferred to a system-wide "Ghost-user". To avoid data loss, + consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, + it cannot be undone or recovered.') + + %div{ data: { modal: "delete-with-contributions", + title: s_("AdminUsers|Delete User %{username} and contributions?"), + action: s_('AdminUsers|Delete user and contributions') , + 'secondary-action': s_('AdminUsers|Block user') } } + = s_('AdminUsers|You are about to permanently delete the user %{username}. This will delete all of the issues, + merge requests, and groups linked to them. To avoid data loss, + consider using the %{strong_start}block user%{strong_end} feature instead. Once you %{strong_start}Delete user%{strong_end}, + it cannot be undone or recovered.') + diff --git a/app/views/admin/users/_user.html.haml b/app/views/admin/users/_user.html.haml index 90a056dfe30..ca5109614fc 100644 --- a/app/views/admin/users/_user.html.haml +++ b/app/views/admin/users/_user.html.haml @@ -31,7 +31,19 @@ - elsif user.blocked? = link_to _('Unblock'), unblock_admin_user_path(user), method: :put - else - = link_to _('Block'), block_admin_user_path(user), data: { confirm: "#{s_('AdminUsers|User will be blocked').upcase}! #{_('Are you sure')}?" }, method: :put + %button.btn{ data: { 'gl-modal-action': 'block', + url: block_admin_user_path(user), + username: sanitize_name(user.name) } } + = s_('AdminUsers|Block') + - if user.can_be_deactivated? + %li + %button.btn{ data: { 'gl-modal-action': 'deactivate', + url: deactivate_admin_user_path(user), + username: sanitize_name(user.name) } } + = s_('AdminUsers|Deactivate') + - elsif user.deactivated? + %li + = link_to _('Activate'), activate_admin_user_path(user), method: :put - if user.access_locked? %li = link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') } @@ -39,19 +51,14 @@ %li.divider - if user.can_be_removed? %li - %button.delete-user-button.btn.text-danger{ data: { toggle: 'modal', - target: '#delete-user-modal', + %button.delete-user-button.btn.text-danger{ 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), - delete_contributions: false }, type: 'button' } + username: sanitize_name(user.name) } } = s_('AdminUsers|Delete user') - - %li - %button.delete-user-button.btn.text-danger{ data: { toggle: 'modal', - target: '#delete-user-modal', - delete_user_url: admin_user_path(user, hard_delete: true), - block_user_url: block_admin_user_path(user), - username: sanitize_name(user.name), - delete_contributions: true }, type: 'button' } - = s_('AdminUsers|Delete user and contributions') + %li + %button.delete-user-button.btn.text-danger{ 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') diff --git a/app/views/admin/users/_user_activation_effects.html.haml b/app/views/admin/users/_user_activation_effects.html.haml new file mode 100644 index 00000000000..244836dac11 --- /dev/null +++ b/app/views/admin/users/_user_activation_effects.html.haml @@ -0,0 +1,6 @@ +%p + = s_('AdminUsers|Reactivating a user will:') +%ul + %li + = s_('AdminUsers|Restore user access to the account, including web, Git and API.') + = render_if_exists 'admin/users/user_activation_effects_on_seats' diff --git a/app/views/admin/users/_user_block_effects.html.haml b/app/views/admin/users/_user_block_effects.html.haml new file mode 100644 index 00000000000..8ffbe145169 --- /dev/null +++ b/app/views/admin/users/_user_block_effects.html.haml @@ -0,0 +1,11 @@ +%p + = s_('AdminUsers|Blocking user has the following effects:') +%ul + %li + = s_('AdminUsers|User will not be able to login') + %li + = s_('AdminUsers|User will not be able to access git repositories') + %li + = s_('AdminUsers|Personal projects will be left') + %li + = s_('AdminUsers|Owned groups will be left') diff --git a/app/views/admin/users/_user_deactivation_effects.html.haml b/app/views/admin/users/_user_deactivation_effects.html.haml new file mode 100644 index 00000000000..6cc47214d77 --- /dev/null +++ b/app/views/admin/users/_user_deactivation_effects.html.haml @@ -0,0 +1,16 @@ +%p + = s_('AdminUsers|Deactivating a user has the following effects:') +%ul + %li + = s_('AdminUsers|The user will be logged out') + %li + = s_('AdminUsers|The user will not be able to access git repositories') + %li + = s_('AdminUsers|The user will not be able to access the API') + %li + = s_('AdminUsers|The user will not receive any notifications') + %li + = s_('AdminUsers|When the user logs back in, their account will reactivate as a fully active account') + %li + = s_('AdminUsers|Personal projects, group and user history will be left intact') + = render_if_exists 'admin/users/user_deactivation_effects_on_seats' diff --git a/app/views/admin/users/index.html.haml b/app/views/admin/users/index.html.haml index 9ce16749945..3c6ad899d1e 100644 --- a/app/views/admin/users/index.html.haml +++ b/app/views/admin/users/index.html.haml @@ -30,6 +30,10 @@ = link_to admin_users_path(filter: "blocked") do = s_('AdminUsers|Blocked') %small.badge.badge-pill= limited_counter_with_delimiter(User.blocked) + = nav_link(html_options: { class: active_when(params[:filter] == 'deactivated') }) do + = link_to admin_users_path(filter: "deactivated") do + = s_('AdminUsers|Deactivated') + %small.badge.badge-pill= limited_counter_with_delimiter(User.deactivated) = nav_link(html_options: { class: active_when(params[:filter] == 'wop') }) do = link_to admin_users_path(filter: "wop") do = s_('AdminUsers|Without projects') @@ -50,6 +54,7 @@ = icon("search", class: "search-icon") = button_tag s_('AdminUsers|Search users') if Rails.env.test? .dropdown.user-sort-dropdown + = label_tag 'Sort by', nil, class: 'label-bold' - toggle_text = @sort.present? ? users_sort_options_hash[@sort] : sort_title_name = dropdown_toggle(toggle_text, { toggle: 'dropdown' }) %ul.dropdown-menu.dropdown-menu-right @@ -74,4 +79,4 @@ = paginate @users, theme: "gitlab" -#delete-user-modal += render partial: 'admin/users/modals' diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml index a988f746ced..706fa033c51 100644 --- a/app/views/admin/users/show.html.haml +++ b/app/views/admin/users/show.html.haml @@ -156,6 +156,27 @@ = render_if_exists 'admin/users/user_detail_note' + - if @user.deactivated? + .card.border-info + .card-header.bg-info.text-white + Reactivate this user + .card-body + = render partial: 'admin/users/user_activation_effects' + %br + = link_to 'Activate user', activate_admin_user_path(@user), method: :put, class: "btn btn-info", data: { confirm: 'Are you sure?' } + - elsif @user.can_be_deactivated? + .card.border-warning + .card-header.bg-warning.text-white + Deactivate this user + .card-body + = render partial: 'admin/users/user_deactivation_effects' + %br + %button.btn.btn-warning{ data: { 'gl-modal-action': 'deactivate', + content: 'You can always re-activate their account, their data will remain intact.', + url: deactivate_admin_user_path(@user), + username: sanitize_name(@user.name) } } + = s_('AdminUsers|Deactivate user') + - if @user.blocked? .card.border-info .card-header.bg-info.text-white @@ -172,14 +193,13 @@ .card-header.bg-warning.text-white Block this user .card-body - %p Blocking user has the following effects: - %ul - %li User will not be able to login - %li User will not be able to access git repositories - %li Personal projects will be left - %li Owned groups will be left + = render partial: 'admin/users/user_block_effects' %br - = link_to 'Block user', block_admin_user_path(@user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put, class: "btn btn-warning" + %button.btn.btn-warning{ data: { 'gl-modal-action': 'block', + content: 'You can always unblock their account, their data will remain intact.', + url: block_admin_user_path(@user), + username: sanitize_name(@user.name) } } + = s_('AdminUsers|Block user') - if @user.access_locked? .card.border-info .card-header.bg-info.text-white @@ -197,12 +217,10 @@ %p Deleting a user has the following effects: = render 'users/deletion_guidance', user: @user %br - %button.delete-user-button.btn.btn-danger{ data: { toggle: 'modal', - target: '#delete-user-modal', + %button.delete-user-button.btn.btn-danger{ data: { 'gl-modal-action': 'delete', delete_user_url: admin_user_path(@user), block_user_url: block_admin_user_path(@user), - username: @user.name, - delete_contributions: false }, type: 'button' } + username: sanitize_name(@user.name) } } = s_('AdminUsers|Delete user') - else - if @user.solo_owned_groups.present? @@ -229,15 +247,13 @@ the user, and projects in them, will also be removed. Commits to other projects are unaffected. %br - %button.delete-user-button.btn.btn-danger{ data: { toggle: 'modal', - target: '#delete-user-modal', + %button.delete-user-button.btn.btn-danger{ 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: @user.name, - delete_contributions: true }, type: 'button' } + username: @user.name } } = s_('AdminUsers|Delete user and contributions') - else %p You don't have access to delete this user. - #delete-user-modal += render partial: 'admin/users/modals' |