summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBerna Castro <bernacas@gmail.com>2016-12-15 13:09:07 +0100
committerOswaldo Ferreira <oswaldo@gitlab.com>2017-01-27 20:20:17 -0200
commitc85c681505b3d52f8ffa6729ebbbf2846e73cf30 (patch)
treed2ed5124b1c6d11baaf546e1d4cd3a871465aada
parent4e2b9d703f3b3d3f64a25ff9ae33eb56210c1715 (diff)
downloadgitlab-ce-c85c681505b3d52f8ffa6729ebbbf2846e73cf30.tar.gz
Add the group path to the issue ID if applicable
-rw-r--r--app/models/project.rb16
-rw-r--r--app/views/projects/issues/_issue.html.haml2
2 files changed, 13 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 59faf35e051..b6ec54af3f3 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -591,10 +591,18 @@ class Project < ActiveRecord::Base
end
end
- def to_reference(from_project = nil, full: false)
- if full || cross_namespace_reference?(from_project)
- path_with_namespace
- elsif cross_project_reference?(from_project)
+ def to_reference(from_project = nil, from_group = nil)
+ if from_group.nil?
+ if cross_namespace_reference?(from_project)
+ path_with_namespace
+ elsif cross_project_reference?(from_project)
+ path
+ elsif self == from_project
+ nil
+ else
+ path_with_namespace
+ end
+ else
path
end
end
diff --git a/app/views/projects/issues/_issue.html.haml b/app/views/projects/issues/_issue.html.haml
index bd46af339cf..8bb3fe6ba26 100644
--- a/app/views/projects/issues/_issue.html.haml
+++ b/app/views/projects/issues/_issue.html.haml
@@ -34,7 +34,7 @@
= note_count
.issue-info
- #{issue.to_reference} &middot;
+ #{issue.to_reference(@project, @group)} &middot;
opened #{time_ago_with_tooltip(issue.created_at, placement: 'bottom')}
by #{link_to_member(@project, issue.author, avatar: false)}
- if issue.milestone