summaryrefslogtreecommitdiff
path: root/app/controllers/snippets_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /app/controllers/snippets_controller.rb
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-48aff82709769b098321c738f3444b9bdaa694c6.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/controllers/snippets_controller.rb')
-rw-r--r--app/controllers/snippets_controller.rb27
1 files changed, 3 insertions, 24 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb
index 486c7f1d028..913b1e3bb6e 100644
--- a/app/controllers/snippets_controller.rb
+++ b/app/controllers/snippets_controller.rb
@@ -6,21 +6,16 @@ class SnippetsController < Snippets::ApplicationController
include ToggleAwardEmoji
include SpammableActions
- before_action :snippet, only: [:show, :edit, :destroy, :update, :raw, :toggle_award_emoji, :mark_as_spam]
+ before_action :snippet, only: [:show, :edit, :raw, :toggle_award_emoji, :mark_as_spam]
- before_action :authorize_create_snippet!, only: [:new, :create]
+ before_action :authorize_create_snippet!, only: :new
before_action :authorize_read_snippet!, only: [:show, :raw]
- before_action :authorize_update_snippet!, only: [:edit, :update]
- before_action :authorize_admin_snippet!, only: [:destroy]
+ before_action :authorize_update_snippet!, only: :edit
skip_before_action :authenticate_user!, only: [:index, :show, :raw]
layout 'snippets'
- before_action do
- push_frontend_feature_flag(:snippet_multiple_files, current_user)
- end
-
def index
if params[:username].present?
@user = UserFinder.new(params[:username]).find_by_username!
@@ -44,18 +39,6 @@ class SnippetsController < Snippets::ApplicationController
@snippet = PersonalSnippet.new
end
- def create
- create_params = snippet_params.merge(files: params.delete(:files))
- service_response = Snippets::CreateService.new(nil, current_user, create_params).execute
- @snippet = service_response.payload[:snippet]
-
- if service_response.error? && @snippet.errors[:repository].present?
- handle_repository_error(:new)
- else
- recaptcha_check_with_fallback { render :new }
- end
- end
-
protected
alias_method :awardable, :snippet
@@ -64,8 +47,4 @@ class SnippetsController < Snippets::ApplicationController
def spammable_path
snippet_path(@snippet)
end
-
- def snippet_params
- params.require(:personal_snippet).permit(:title, :content, :file_name, :private, :visibility_level, :description).merge(spammable_params)
- end
end