Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Thomas <iamgeorgethomas@gmail.com>2019-02-27 10:41:14 +0300
committerGeorge Thomas <george.thomas@quintype.com>2019-07-18 07:34:06 +0300
commita9707e8cf70487a52efbe43ffe72c9e995f5cdea (patch)
tree9c923ed7fc686d94820a47798d0e0c2d3af3a120 /app/controllers/projects/snippets_controller.rb
parent037096ef6c2c2f804302efb429bcd1eb5123b5e9 (diff)
Rewrite `if:` argument in before_action and alike when `only:` is also used
Closes #55564 This is first discovered in #54739 (comment 122609857) that if both if: and only: are used in a before_action or after_action or alike, if: is completely ignored.
Diffstat (limited to 'app/controllers/projects/snippets_controller.rb')
-rw-r--r--app/controllers/projects/snippets_controller.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/projects/snippets_controller.rb b/app/controllers/projects/snippets_controller.rb
index 255f1f3569a..59f948959d6 100644
--- a/app/controllers/projects/snippets_controller.rb
+++ b/app/controllers/projects/snippets_controller.rb
@@ -7,7 +7,8 @@ class Projects::SnippetsController < Projects::ApplicationController
include SnippetsActions
include RendersBlob
- skip_before_action :verify_authenticity_token, only: [:show], if: :js_request?
+ skip_before_action :verify_authenticity_token,
+ if: -> { action_name == 'show' && js_request? }
before_action :check_snippets_available!
before_action :snippet, only: [:show, :edit, :destroy, :update, :raw, :toggle_award_emoji, :mark_as_spam]