summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-14 18:10:34 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-14 18:10:34 +0000
commit7d4b2ed7bf75d316577b718c71a9fdef19184539 (patch)
treed709e00c4f2ab60901749883f324f9069343037c /app/helpers
parent7172fb10313a9a7790f8e033b347e77df4987154 (diff)
downloadgitlab-ce-7d4b2ed7bf75d316577b718c71a9fdef19184539.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/users_helper.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 998c697e617..c1d05c2d3cf 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -162,6 +162,49 @@ module UsersHelper
header + list
end
+ def user_ban_data(user)
+ {
+ path: ban_admin_user_path(user),
+ method: 'put',
+ modal_attributes: {
+ title: s_('AdminUsers|Ban user %{username}?') % { username: sanitize_name(user.name) },
+ message: s_('AdminUsers|You can unban their account in the future. Their data remains intact.'),
+ okVariant: 'warning',
+ okTitle: s_('AdminUsers|Ban')
+ }.to_json
+ }
+ end
+
+ def user_unban_data(user)
+ {
+ path: unban_admin_user_path(user),
+ method: 'put',
+ modal_attributes: {
+ title: s_('AdminUsers|Unban %{username}?') % { username: sanitize_name(user.name) },
+ message: s_('AdminUsers|You ban their account in the future if necessary.'),
+ okVariant: 'info',
+ okTitle: s_('AdminUsers|Unban')
+ }.to_json
+ }
+ end
+
+ def user_ban_effects
+ header = tag.p s_('AdminUsers|Banning the user has the following effects:')
+
+ list = tag.ul do
+ concat tag.li s_('AdminUsers|User will be blocked')
+ end
+
+ link_start = '<a href="%{url}" target="_blank">'.html_safe % { url: help_page_path("user/admin_area/moderate_users", anchor: "ban-a-user") }
+ info = tag.p s_('AdminUsers|Learn more about %{link_start}banned users.%{link_end}').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
+
+ header + list + info
+ end
+
+ def ban_feature_available?
+ Feature.enabled?(:ban_user_feature_flag)
+ end
+
def user_deactivation_data(user, message)
{
path: deactivate_admin_user_path(user),
@@ -235,6 +278,9 @@ module UsersHelper
pending_approval_badge = { text: s_('AdminUsers|Pending approval'), variant: 'info' }
return pending_approval_badge if user.blocked_pending_approval?
+ banned_badge = { text: s_('AdminUsers|Banned'), variant: 'danger' }
+ return banned_badge if user.banned?
+
{ text: s_('AdminUsers|Blocked'), variant: 'danger' }
end