diff options
author | George Thomas <iamgeorgethomas@gmail.com> | 2019-02-27 13:11:14 +0530 |
---|---|---|
committer | George Thomas <george.thomas@quintype.com> | 2019-07-18 10:04:06 +0530 |
commit | a9707e8cf70487a52efbe43ffe72c9e995f5cdea (patch) | |
tree | 9c923ed7fc686d94820a47798d0e0c2d3af3a120 /app/controllers/snippets_controller.rb | |
parent | 037096ef6c2c2f804302efb429bcd1eb5123b5e9 (diff) | |
download | gitlab-ce-a9707e8cf70487a52efbe43ffe72c9e995f5cdea.tar.gz |
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/snippets_controller.rb')
-rw-r--r-- | app/controllers/snippets_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index fad036b8df8..869655e9550 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -8,7 +8,8 @@ class SnippetsController < ApplicationController include RendersBlob include PreviewMarkdown - 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 :snippet, only: [:show, :edit, :destroy, :update, :raw] |