Skip to content

Commit

Permalink
Make require_package before action private
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Dec 21, 2023
1 parent 625b3bc commit 50dcbdf
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/api/app/controllers/source_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,6 @@ def delete_package
render_ok
end

# before_action for show_package, delete_package and package_command
def require_package
# init and validation
#--------------------
@deleted_package = params.key?(:deleted)

# FIXME: for OBS 3, api of branch and copy calls have target and source in the opossite place
if params[:cmd].in?(['branch', 'release'])
@target_package_name = params[:package]
@target_project_name = params[:target_project] # might be nil
@target_package_name = params[:target_package] if params[:target_package]
else
@target_project_name = params[:project]
@target_package_name = params[:package]
end
end

def verify_can_modify_target_package!
return if User.session!.can_modify?(@package)

Expand Down Expand Up @@ -430,6 +413,23 @@ def set_issues_defaults

private

# before_action for show_package, delete_package and package_command
def require_package
# init and validation
#--------------------
@deleted_package = params.key?(:deleted)

# FIXME: for OBS 3, api of branch and copy calls have target and source in the opossite place
if params[:cmd].in?(['branch', 'release'])
@target_package_name = params[:package]
@target_project_name = params[:target_project] # might be nil
@target_package_name = params[:target_package] if params[:target_package]
else
@target_project_name = params[:project]
@target_package_name = params[:package]
end
end

# GET /source/:project/:package?view=issues
# called from show_package
def show_package_issues
Expand Down

0 comments on commit 50dcbdf

Please sign in to comment.