summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/abuse_reports_controller.rb4
-rw-r--r--app/controllers/profiles/preferences_controller.rb1
-rw-r--r--app/helpers/users_helper.rb12
-rw-r--r--app/models/user.rb1
-rw-r--r--app/models/user_preference.rb1
-rw-r--r--app/views/admin/spam_logs/_spam_log.html.haml2
-rw-r--r--app/views/admin/spam_logs/index.html.haml1
-rw-r--r--app/views/profiles/preferences/show.html.haml2
-rw-r--r--app/views/projects/_files.html.haml3
9 files changed, 24 insertions, 3 deletions
diff --git a/app/controllers/abuse_reports_controller.rb b/app/controllers/abuse_reports_controller.rb
index edeac57bc42..55aef945702 100644
--- a/app/controllers/abuse_reports_controller.rb
+++ b/app/controllers/abuse_reports_controller.rb
@@ -64,8 +64,8 @@ class AbuseReportsController < ApplicationController
if @user.nil?
redirect_to root_path, alert: _("Cannot create the abuse report. The user has been deleted.")
- elsif @user.blocked?
- redirect_to @user, alert: _("Cannot create the abuse report. This user has been blocked.")
+ elsif @user.banned?
+ redirect_to @user, alert: _("Cannot create the abuse report. This user has been banned.")
end
end
# rubocop: enable CodeReuse/ActiveRecord
diff --git a/app/controllers/profiles/preferences_controller.rb b/app/controllers/profiles/preferences_controller.rb
index a5a2cbf3733..f19113276c2 100644
--- a/app/controllers/profiles/preferences_controller.rb
+++ b/app/controllers/profiles/preferences_controller.rb
@@ -54,6 +54,7 @@ class Profiles::PreferencesController < Profiles::ApplicationController
:sourcegraph_enabled,
:gitpod_enabled,
:render_whitespace_in_code,
+ :project_shortcut_buttons,
:markdown_surround_selection,
:markdown_automatic_lists,
:use_new_navigation
diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb
index 60230d58e30..c6edb16e5a1 100644
--- a/app/helpers/users_helper.rb
+++ b/app/helpers/users_helper.rb
@@ -192,6 +192,18 @@ module UsersHelper
}
end
+ def moderation_status(user)
+ return unless user.present?
+
+ if user.banned?
+ _('Banned')
+ elsif user.blocked?
+ _('Blocked')
+ else
+ _('Active')
+ end
+ end
+
private
def admin_users_paths
diff --git a/app/models/user.rb b/app/models/user.rb
index 0c8ff873ba6..8075affdf03 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -361,6 +361,7 @@ class User < ApplicationRecord
:sourcegraph_enabled, :sourcegraph_enabled=,
:gitpod_enabled, :gitpod_enabled=,
:setup_for_company, :setup_for_company=,
+ :project_shortcut_buttons, :project_shortcut_buttons=,
:render_whitespace_in_code, :render_whitespace_in_code=,
:markdown_surround_selection, :markdown_surround_selection=,
:markdown_automatic_lists, :markdown_automatic_lists=,
diff --git a/app/models/user_preference.rb b/app/models/user_preference.rb
index 90449411f8a..e527542e357 100644
--- a/app/models/user_preference.rb
+++ b/app/models/user_preference.rb
@@ -35,6 +35,7 @@ class UserPreference < ApplicationRecord
attribute :tab_width, default: -> { Gitlab::TabWidth::DEFAULT }
attribute :time_display_relative, default: true
attribute :render_whitespace_in_code, default: false
+ attribute :project_shortcut_buttons, default: true
enum visibility_pipeline_id_type: { id: 0, iid: 1 }
diff --git a/app/views/admin/spam_logs/_spam_log.html.haml b/app/views/admin/spam_logs/_spam_log.html.haml
index 183667679b9..6aed8508a6a 100644
--- a/app/views/admin/spam_logs/_spam_log.html.haml
+++ b/app/views/admin/spam_logs/_spam_log.html.haml
@@ -22,6 +22,8 @@
%td
= truncate(spam_log.description, length: 100)
%td
+ = moderation_status(user)
+ %td
- if user
= render Pajamas::ButtonComponent.new(size: :small,
variant: :danger,
diff --git a/app/views/admin/spam_logs/index.html.haml b/app/views/admin/spam_logs/index.html.haml
index 001662c4015..9a0756510ec 100644
--- a/app/views/admin/spam_logs/index.html.haml
+++ b/app/views/admin/spam_logs/index.html.haml
@@ -14,6 +14,7 @@
%th= _('Type')
%th= _('Title')
%th= _('Description')
+ %th= _('User Status')
%th= _('Primary Action')
%th
= render @spam_logs
diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml
index 7f8858411ca..19dc7a1d9b9 100644
--- a/app/views/profiles/preferences/show.html.haml
+++ b/app/views/profiles/preferences/show.html.haml
@@ -90,6 +90,8 @@
.form-text.text-muted
= s_('Preferences|Choose what content you want to see on a project’s overview page.')
.form-group
+ = f.gitlab_ui_checkbox_component :project_shortcut_buttons, s_('Preferences|Show shortcut buttons above files on project overview')
+ .form-group
= f.gitlab_ui_checkbox_component :render_whitespace_in_code, s_('Preferences|Render whitespace characters in the Web IDE')
.form-group
= f.gitlab_ui_checkbox_component :show_whitespace_in_diffs, s_('Preferences|Show whitespace changes in diffs')
diff --git a/app/views/projects/_files.html.haml b/app/views/projects/_files.html.haml
index 5c7f83fc579..60535d704c4 100644
--- a/app/views/projects/_files.html.haml
+++ b/app/views/projects/_files.html.haml
@@ -2,6 +2,7 @@
- is_project_overview = local_assigns.fetch(:is_project_overview, false)
- ref = local_assigns.fetch(:ref) { current_ref }
- project = local_assigns.fetch(:project) { @project }
+- has_project_shortcut_buttons = !current_user || current_user.project_shortcut_buttons
- add_page_startup_api_call logs_file_project_ref_path(@project, ref, @path, format: "json", offset: 0)
- if readme_path = @project.repository.readme_path
- add_page_startup_api_call project_blob_path(@project, tree_join(@ref, readme_path), viewer: "rich", format: "json")
@@ -18,7 +19,7 @@
- if project.forked?
#js-fork-info{ data: vue_fork_divergence_data(project, ref) }
- - if is_project_overview
+ - if is_project_overview && has_project_shortcut_buttons
.project-buttons.gl-mb-5.js-show-on-project-root{ data: { qa_selector: 'project_buttons' } }
= render 'stat_anchor_list', anchors: @project.statistics_buttons(show_auto_devops_callout: show_auto_devops_callout), project_buttons: true