Add redirect from Issue#id to Issue#iid
This commit is contained in:
parent
c8e3d31925
commit
dc016fef39
|
@ -91,7 +91,11 @@ class Projects::IssuesController < Projects::ApplicationController
|
|||
protected
|
||||
|
||||
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
|
||||
|
||||
def authorize_modify_issue!
|
||||
|
@ -109,4 +113,20 @@ class Projects::IssuesController < Projects::ApplicationController
|
|||
def issues_filtered
|
||||
@issues = Issues::ListContext.new(project, current_user, params).execute
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue