Skip to content

Commit

Permalink
[api] Re-use before_action to DRY code
Browse files Browse the repository at this point in the history
With this commit we will use the existing require_request before_action
and remove the code that took care of this before from the show action.
  • Loading branch information
bgeuken committed Oct 9, 2017
1 parent 802f2c9 commit cac9d20
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/api/app/controllers/webui/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Webui::RequestController < Webui::WebuiController
# requests do not really add much value for our page rank :)
before_action :lockout_spiders

before_action :require_request, only: [:changerequest]
before_action :require_request, only: [:changerequest, :show]

before_action :set_project, only: [:change_devel_request_dialog]

Expand Down Expand Up @@ -79,12 +79,6 @@ def modify_review
end

def show
@bs_request = BsRequest.find_by_number(params[:number])
unless @bs_request
flash[:error] = "Can't find request #{params[:number]}"
redirect_back(fallback_location: user_show_path(User.current)) && return
end

@req = @bs_request.webui_infos
@id = @req['id']
@number = @req['number']
Expand Down

0 comments on commit cac9d20

Please sign in to comment.