diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-10-20 08:43:02 +0000 |
commit | d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb (patch) | |
tree | 2341ef426af70ad1e289c38036737e04b0aa5007 /app/controllers/admin | |
parent | d6e514dd13db8947884cd58fe2a9c2a063400a9b (diff) | |
download | gitlab-ce-d9ab72d6080f594d0b3cae15f14b3ef2c6c638cb.tar.gz |
Add latest changes from gitlab-org/gitlab@14-4-stable-eev14.4.0-rc42
Diffstat (limited to 'app/controllers/admin')
-rw-r--r-- | app/controllers/admin/dashboard_controller.rb | 9 | ||||
-rw-r--r-- | app/controllers/admin/instance_review_controller.rb | 2 | ||||
-rw-r--r-- | app/controllers/admin/serverless/domains_controller.rb | 78 | ||||
-rw-r--r-- | app/controllers/admin/topics/avatars_controller.rb | 14 | ||||
-rw-r--r-- | app/controllers/admin/topics_controller.rb | 57 |
5 files changed, 80 insertions, 80 deletions
diff --git a/app/controllers/admin/dashboard_controller.rb b/app/controllers/admin/dashboard_controller.rb index ba24e3e619b..d12ccfc7423 100644 --- a/app/controllers/admin/dashboard_controller.rb +++ b/app/controllers/admin/dashboard_controller.rb @@ -15,7 +15,14 @@ class Admin::DashboardController < Admin::ApplicationController @groups = Group.order_id_desc.with_route.limit(10) @notices = Gitlab::ConfigChecker::PumaRuggedChecker.check @notices += Gitlab::ConfigChecker::ExternalDatabaseChecker.check - @redis_versions = [Gitlab::Redis::Queues, Gitlab::Redis::SharedState, Gitlab::Redis::Cache, Gitlab::Redis::TraceChunks].map(&:version).uniq + @redis_versions = [ + Gitlab::Redis::Queues, + Gitlab::Redis::SharedState, + Gitlab::Redis::Cache, + Gitlab::Redis::TraceChunks, + Gitlab::Redis::RateLimiting, + Gitlab::Redis::Sessions + ].map(&:version).uniq end # rubocop: enable CodeReuse/ActiveRecord diff --git a/app/controllers/admin/instance_review_controller.rb b/app/controllers/admin/instance_review_controller.rb index 88ca2c88aab..5567ffbdc84 100644 --- a/app/controllers/admin/instance_review_controller.rb +++ b/app/controllers/admin/instance_review_controller.rb @@ -3,7 +3,7 @@ class Admin::InstanceReviewController < Admin::ApplicationController feature_category :devops_reports def index - redirect_to("#{::Gitlab::SubscriptionPortal::SUBSCRIPTIONS_URL}/instance_review?#{instance_review_params}") + redirect_to("#{Gitlab::SubscriptionPortal.subscriptions_instance_review_url}?#{instance_review_params}") end def instance_review_params diff --git a/app/controllers/admin/serverless/domains_controller.rb b/app/controllers/admin/serverless/domains_controller.rb deleted file mode 100644 index 49cd9f7a36d..00000000000 --- a/app/controllers/admin/serverless/domains_controller.rb +++ /dev/null @@ -1,78 +0,0 @@ -# frozen_string_literal: true - -class Admin::Serverless::DomainsController < Admin::ApplicationController - before_action :check_feature_flag - before_action :domain, only: [:update, :verify, :destroy] - - feature_category :serverless - - def index - @domain = PagesDomain.instance_serverless.first_or_initialize - end - - def create - if PagesDomain.instance_serverless.exists? - return redirect_to admin_serverless_domains_path, notice: _('An instance-level serverless domain already exists.') - end - - @domain = PagesDomain.instance_serverless.create(create_params) - - if @domain.persisted? - redirect_to admin_serverless_domains_path, notice: _('Domain was successfully created.') - else - render 'index' - end - end - - def update - if domain.update(update_params) - redirect_to admin_serverless_domains_path, notice: _('Domain was successfully updated.') - else - render 'index' - end - end - - def destroy - if domain.serverless_domain_clusters.exists? - return redirect_to admin_serverless_domains_path, - status: :conflict, - notice: _('Domain cannot be deleted while associated to one or more clusters.') - end - - domain.destroy! - - redirect_to admin_serverless_domains_path, - status: :found, - notice: _('Domain was successfully deleted.') - end - - def verify - result = VerifyPagesDomainService.new(domain).execute - - if result[:status] == :success - flash[:notice] = _('Successfully verified domain ownership') - else - flash[:alert] = _('Failed to verify domain ownership') - end - - redirect_to admin_serverless_domains_path - end - - private - - def domain - @domain = PagesDomain.instance_serverless.find(params[:id]) - end - - def check_feature_flag - render_404 unless Feature.enabled?(:serverless_domain) - end - - def update_params - params.require(:pages_domain).permit(:user_provided_certificate, :user_provided_key) - end - - def create_params - params.require(:pages_domain).permit(:domain, :user_provided_certificate, :user_provided_key) - end -end diff --git a/app/controllers/admin/topics/avatars_controller.rb b/app/controllers/admin/topics/avatars_controller.rb new file mode 100644 index 00000000000..7acdec424b4 --- /dev/null +++ b/app/controllers/admin/topics/avatars_controller.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class Admin::Topics::AvatarsController < Admin::ApplicationController + feature_category :projects + + def destroy + @topic = Projects::Topic.find(params[:topic_id]) + + @topic.remove_avatar! + @topic.save + + redirect_to edit_admin_topic_path(@topic), status: :found + end +end diff --git a/app/controllers/admin/topics_controller.rb b/app/controllers/admin/topics_controller.rb new file mode 100644 index 00000000000..ccc38ba7cd5 --- /dev/null +++ b/app/controllers/admin/topics_controller.rb @@ -0,0 +1,57 @@ +# frozen_string_literal: true + +class Admin::TopicsController < Admin::ApplicationController + include SendFileUpload + include PreviewMarkdown + + before_action :topic, only: [:edit, :update] + + feature_category :projects + + def index + @topics = Projects::TopicsFinder.new(params: params.permit(:search)).execute.page(params[:page]).without_count + end + + def new + @topic = Projects::Topic.new + end + + def edit + end + + def create + @topic = Projects::Topic.new(topic_params) + + if @topic.save + redirect_to edit_admin_topic_path(@topic), notice: _('Topic %{topic_name} was successfully created.') % { topic_name: @topic.name } + else + render "new" + end + end + + def update + if @topic.update(topic_params) + redirect_to edit_admin_topic_path(@topic), notice: _('Topic was successfully updated.') + else + render "edit" + end + end + + private + + def topic + @topic ||= Projects::Topic.find(params[:id]) + end + + def topic_params + params.require(:projects_topic).permit(allowed_topic_params) + end + + def allowed_topic_params + [ + :avatar, + :description, + :name + ] + end +end |