diff options
author | Mario de la Ossa <mariodelaossa@gmail.com> | 2017-12-18 23:14:08 -0600 |
---|---|---|
committer | Mario de la Ossa <mariodelaossa@gmail.com> | 2017-12-18 23:18:23 -0600 |
commit | d02059ddf3fef105a8e835024b589d9eac2140f0 (patch) | |
tree | ae854ac277d736fd23532fc54e2c46ecee2c0fbc /app/models/blob_viewer | |
parent | b03789395c59ce94c8bdb4e0f4806c8cd7705f46 (diff) | |
download | gitlab-ce-d02059ddf3fef105a8e835024b589d9eac2140f0.tar.gz |
BlobViewer::PackageJson - if private link to homepage
Diffstat (limited to 'app/models/blob_viewer')
-rw-r--r-- | app/models/blob_viewer/package_json.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/models/blob_viewer/package_json.rb b/app/models/blob_viewer/package_json.rb index 6ce61e30d3d..46cd2f04f4d 100644 --- a/app/models/blob_viewer/package_json.rb +++ b/app/models/blob_viewer/package_json.rb @@ -21,9 +21,7 @@ module BlobViewer end def package_url - return nil if private? - - "https://www.npmjs.com/package/#{package_name}" + private? ? homepage : npm_url end private @@ -31,5 +29,13 @@ module BlobViewer def private? !!json_data['private'] end + + def homepage + json_data['homepage'] + end + + def npm_url + "https://www.npmjs.com/package/#{package_name}" + end end end |