Commit dc016fef authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add redirect from Issue#id to Issue#iid

parent c8e3d319
...@@ -91,7 +91,11 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -91,7 +91,11 @@ class Projects::IssuesController < Projects::ApplicationController
protected protected
def issue def issue
@issue ||= @project.issues.find_by_iid!(params[:id]) @issue ||= begin
@project.issues.find_by_iid!(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_old
end
end end
def authorize_modify_issue! def authorize_modify_issue!
...@@ -109,4 +113,20 @@ class Projects::IssuesController < Projects::ApplicationController ...@@ -109,4 +113,20 @@ class Projects::IssuesController < Projects::ApplicationController
def issues_filtered def issues_filtered
@issues = Issues::ListContext.new(project, current_user, params).execute @issues = Issues::ListContext.new(project, current_user, params).execute
end end
# Since iids are implemented only in 6.1
# user may navigate to issue page using old global ids.
#
# To prevent 404 errors we provide a redirect to correct iids until 7.0 release
#
def redirect_old
issue = @project.issues.find_by_id(params[:id])
if issue
redirect_to project_issue_path(@project, issue)
return
else
raise ActiveRecord::RecordNotFound.new
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment