summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorImre Farkas <ifarkas@gitlab.com>2018-05-22 10:53:37 +0000
committerRémy Coutable <remy@rymai.me>2018-05-22 10:53:37 +0000
commit10237d458d0266787aa15852b525469d0dcb5362 (patch)
tree78b3c883dd5c16c53f668c73c7730bde083544c7 /app
parent4d674bd38c8a3568f6e1295c25c902ef10151aef (diff)
downloadgitlab-ce-10237d458d0266787aa15852b525469d0dcb5362.tar.gz
Expose readme url in Project API
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 35c873830a7..0e727664d39 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -894,6 +894,13 @@ class Project < ActiveRecord::Base
Gitlab::Routing.url_helpers.project_url(self)
end
+ def readme_url
+ readme = repository.readme
+ if readme
+ Gitlab::Routing.url_helpers.project_blob_url(self, File.join(default_branch, readme.path))
+ end
+ end
+
def new_issuable_address(author, address_type)
return unless Gitlab::IncomingEmail.supports_issue_creation? && author