Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify work packages controller filters #16530

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions app/controllers/work_packages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ class WorkPackagesController < ApplicationController
:project, only: :show
before_action :load_and_authorize_in_optional_project,
:check_allowed_export,
:protect_from_unauthorized_export, only: :index
:protect_from_unauthorized_export, only: %i[index export_dialog]
authorization_checked! :index, :show, :export_dialog

before_action :load_and_validate_query, only: :index, unless: -> { request.format.html? }
before_action :load_work_packages, only: :index, if: -> { request.format.atom? }

before_action :load_and_authorize_in_optional_project_for_export, only: :export_dialog, if: -> { request.format.html? }
before_action :load_and_validate_query_for_export, only: :export_dialog, if: -> { request.format.html? }
before_action :load_and_validate_query_for_export, only: :export_dialog

def index
respond_to do |format|
Expand Down Expand Up @@ -94,10 +92,6 @@ def export_dialog

protected

def load_and_authorize_in_optional_project_for_export
load_and_authorize_in_optional_project
end

def load_and_validate_query_for_export
load_and_validate_query
end
Expand Down