summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-01-20 14:50:47 -0600
committerMike Greiling <mike@pixelcog.com>2017-01-20 14:50:47 -0600
commit41b6cfcf03d3320ca7d4439a4e067a14299b7513 (patch)
tree5591c1bf60e1660a3530db6eab2134b85558e1ca
parentff75bd0409f79c8b75cf49a219cfe3257526042d (diff)
downloadgitlab-ce-41b6cfcf03d3320ca7d4439a4e067a14299b7513.tar.gz
automatically redirect urls containing author_id or assignee_id
-rw-r--r--app/controllers/projects/issues_controller.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb
index 2beb0df8a07..8b2e9cfdee5 100644
--- a/app/controllers/projects/issues_controller.rb
+++ b/app/controllers/projects/issues_controller.rb
@@ -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
@@ -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.
#