diff options
author | George Thomas <iamgeorgethomas@gmail.com> | 2019-02-27 10:41:14 +0300 |
---|---|---|
committer | George Thomas <george.thomas@quintype.com> | 2019-07-18 07:34:06 +0300 |
commit | a9707e8cf70487a52efbe43ffe72c9e995f5cdea (patch) | |
tree | 9c923ed7fc686d94820a47798d0e0c2d3af3a120 /app/controllers/projects/wikis_controller.rb | |
parent | 037096ef6c2c2f804302efb429bcd1eb5123b5e9 (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/wikis_controller.rb')
-rw-r--r-- | app/controllers/projects/wikis_controller.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index fa5bdbc7d49..b0998d7f3be 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -10,7 +10,8 @@ class Projects::WikisController < Projects::ApplicationController before_action :authorize_admin_wiki!, only: :destroy before_action :load_project_wiki before_action :load_page, only: [:show, :edit, :update, :history, :destroy] - before_action :valid_encoding?, only: [:show, :edit, :update], if: :load_page + before_action :valid_encoding?, + if: -> { %w[show edit update].include?(action_name) && load_page } before_action only: [:edit, :update], unless: :valid_encoding? do redirect_to(project_wiki_path(@project, @page)) end |