Skip to content
Snippets Groups Projects
Commit 41b6cfcf authored by Mike Greiling's avatar Mike Greiling
Browse files

automatically redirect urls containing author_id or assignee_id

parent ff75bd04
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -23,6 +23,8 @@ class Projects::IssuesController < Projects::ApplicationController
respond_to :html
 
def index
return redirect_to_fixed_params if params[:assignee_id].present? || params[:author_id].present?
@issues = issues_collection
@issues = @issues.page(params[:page])
if @issues.out_of_range? && @issues.total_pages != 0
Loading
Loading
@@ -211,6 +213,22 @@ class Projects::IssuesController < Projects::ApplicationController
end
end
 
def redirect_to_fixed_params
fixed_params = params.except(:assignee_id, :author_id)
if params[:assignee_id].present?
assignee = User.find_by_id(params[:assignee_id])
fixed_params.merge!(assignee_username: assignee.username) if assignee
end
if params[:author_id].present?
author = User.find_by_id(params[:author_id])
fixed_params.merge!(author_username: author.username) if author
end
redirect_to url_for(fixed_params)
end
# Since iids are implemented only in 6.1
# user may navigate to issue page using old global ids.
#
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment