diff options
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/admin/runners_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/concerns/group_tree.rb | 1 | ||||
-rw-r--r-- | app/controllers/concerns/routable_actions.rb | 1 | ||||
-rw-r--r-- | app/controllers/metrics_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/omniauth_callbacks_controller.rb | 3 | ||||
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects/clusters/gcp_controller.rb | 31 | ||||
-rw-r--r-- | app/controllers/projects/deploy_keys_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects/hooks_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests/creations_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/projects_controller.rb | 1 | ||||
-rw-r--r-- | app/controllers/sessions_controller.rb | 1 |
12 files changed, 34 insertions, 10 deletions
diff --git a/app/controllers/admin/runners_controller.rb b/app/controllers/admin/runners_controller.rb index 38b808cdc31..4b01904f2a1 100644 --- a/app/controllers/admin/runners_controller.rb +++ b/app/controllers/admin/runners_controller.rb @@ -65,6 +65,7 @@ class Admin::RunnersController < Admin::ApplicationController else Project.all end + @projects = @projects.where.not(id: runner.projects.select(:id)) if runner.projects.any? @projects = @projects.page(params[:page]).per(30) end diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb index b10147835f3..b569029283f 100644 --- a/app/controllers/concerns/group_tree.rb +++ b/app/controllers/concerns/group_tree.rb @@ -8,6 +8,7 @@ module GroupTree # Only show root groups if no parent-id is given groups.where(parent_id: params[:parent_id]) end + @groups = @groups.with_selects_for_list(archived: params[:archived]) .sort(@sort = params[:sort]) .page(params[:page]) diff --git a/app/controllers/concerns/routable_actions.rb b/app/controllers/concerns/routable_actions.rb index 4199da9cdf5..f745deb083c 100644 --- a/app/controllers/concerns/routable_actions.rb +++ b/app/controllers/concerns/routable_actions.rb @@ -32,6 +32,7 @@ module RoutableActions if canonical_path.casecmp(requested_full_path) != 0 flash[:notice] = "#{routable.class.to_s.titleize} '#{requested_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." end + redirect_to build_canonical_path(routable) end end diff --git a/app/controllers/metrics_controller.rb b/app/controllers/metrics_controller.rb index d81ad135198..33b682d2859 100644 --- a/app/controllers/metrics_controller.rb +++ b/app/controllers/metrics_controller.rb @@ -12,6 +12,7 @@ class MetricsController < ActionController::Base ) "# Metrics are disabled, see: #{help_page}\n" end + render text: response, content_type: 'text/plain; version=0.0.4' end diff --git a/app/controllers/omniauth_callbacks_controller.rb b/app/controllers/omniauth_callbacks_controller.rb index e3c18cba1dd..689d2e3db22 100644 --- a/app/controllers/omniauth_callbacks_controller.rb +++ b/app/controllers/omniauth_callbacks_controller.rb @@ -83,6 +83,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController if ticket handle_service_ticket oauth['provider'], ticket end + handle_omniauth end @@ -90,6 +91,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController if params['sid'] handle_service_ticket oauth['provider'], params['sid'] end + handle_omniauth end @@ -124,6 +126,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController # Only allow properly saved users to login. if @user.persisted? && @user.valid? log_audit_event(@user, with: oauth['provider']) + if @user.two_factor_enabled? params[:remember_me] = '1' if remember_me? prompt_for_two_factor(@user) diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index d838b8dc29e..35e67730a27 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -150,6 +150,7 @@ class Projects::BlobController < Projects::ApplicationController if params[:file].present? params[:file_name] = params[:file].original_filename end + File.join(@path, params[:file_name]) elsif params[:file_path].present? params[:file_path] diff --git a/app/controllers/projects/clusters/gcp_controller.rb b/app/controllers/projects/clusters/gcp_controller.rb index 25608df0b9c..4fc515bd03e 100644 --- a/app/controllers/projects/clusters/gcp_controller.rb +++ b/app/controllers/projects/clusters/gcp_controller.rb @@ -1,8 +1,9 @@ class Projects::Clusters::GcpController < Projects::ApplicationController before_action :authorize_read_cluster! before_action :authorize_google_api, except: [:login] - before_action :authorize_google_project_billing, only: [:new] + before_action :authorize_google_project_billing, only: [:new, :create] before_action :authorize_create_cluster!, only: [:new, :create] + before_action :verify_billing, only: [:create] def login begin @@ -23,24 +24,34 @@ class Projects::Clusters::GcpController < Projects::ApplicationController end def create + @cluster = ::Clusters::CreateService + .new(project, current_user, create_params) + .execute(token_in_session) + + if @cluster.persisted? + redirect_to project_cluster_path(project, @cluster) + else + render :new + end + end + + private + + def verify_billing case google_project_billing_status when 'true' - @cluster = ::Clusters::CreateService - .new(project, current_user, create_params) - .execute(token_in_session) - - return redirect_to project_cluster_path(project, @cluster) if @cluster.persisted? + return when 'false' - flash[:error] = _('Please enable billing for one of your projects to be able to create a cluster.') + flash[:alert] = _('Please <a href=%{link_to_billing} target="_blank" rel="noopener noreferrer">enable billing for one of your projects to be able to create a cluster</a>, then try again.').html_safe % { link_to_billing: "https://console.cloud.google.com/freetrial?utm_campaign=2018_cpanel&utm_source=gitlab&utm_medium=referral" } else - flash[:error] = _('We could not verify that one of your projects on GCP has billing enabled. Please try again.') + flash[:alert] = _('We could not verify that one of your projects on GCP has billing enabled. Please try again.') end + @cluster = ::Clusters::Cluster.new(create_params) + render :new end - private - def create_params params.require(:cluster).permit( :enabled, diff --git a/app/controllers/projects/deploy_keys_controller.rb b/app/controllers/projects/deploy_keys_controller.rb index cf8829ba95b..e06dda1baa4 100644 --- a/app/controllers/projects/deploy_keys_controller.rb +++ b/app/controllers/projects/deploy_keys_controller.rb @@ -27,6 +27,7 @@ class Projects::DeployKeysController < Projects::ApplicationController unless @key.valid? && @project.deploy_keys << @key flash[:alert] = @key.errors.full_messages.join(', ').html_safe end + redirect_to_repository_settings(@project) end diff --git a/app/controllers/projects/hooks_controller.rb b/app/controllers/projects/hooks_controller.rb index 85d35900c71..6f51e7b9b40 100644 --- a/app/controllers/projects/hooks_controller.rb +++ b/app/controllers/projects/hooks_controller.rb @@ -21,6 +21,7 @@ class Projects::HooksController < Projects::ApplicationController @hooks = @project.hooks.select(&:persisted?) flash[:alert] = @hook.errors.full_messages.join.html_safe end + redirect_to project_settings_integrations_path(@project) end diff --git a/app/controllers/projects/merge_requests/creations_controller.rb b/app/controllers/projects/merge_requests/creations_controller.rb index dc524b790a0..3d2926d5d75 100644 --- a/app/controllers/projects/merge_requests/creations_controller.rb +++ b/app/controllers/projects/merge_requests/creations_controller.rb @@ -48,6 +48,7 @@ class Projects::MergeRequests::CreationsController < Projects::MergeRequests::Ap else [] end + @diff_notes_disabled = true @environment = @merge_request.environments_for(current_user).last diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 6f229b08c0c..e6e2b219e6a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -203,6 +203,7 @@ class ProjectsController < Projects::ApplicationController else flash[:alert] = _("Project export could not be deleted.") end + redirect_to(edit_project_path(@project)) end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d79108c88fb..c73306a6b66 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -28,6 +28,7 @@ class SessionsController < Devise::SessionsController resource.update_attributes(reset_password_token: nil, reset_password_sent_at: nil) end + # hide the signed-in notification flash[:notice] = nil log_audit_event(current_user, resource, with: authentication_method) |