summaryrefslogtreecommitdiff
path: root/app/models/blob_viewer
diff options
context:
space:
mode:
authorMario de la Ossa <mariodelaossa@gmail.com>2017-12-18 23:14:08 -0600
committerMario de la Ossa <mariodelaossa@gmail.com>2017-12-18 23:18:23 -0600
commitd02059ddf3fef105a8e835024b589d9eac2140f0 (patch)
treeae854ac277d736fd23532fc54e2c46ecee2c0fbc /app/models/blob_viewer
parentb03789395c59ce94c8bdb4e0f4806c8cd7705f46 (diff)
downloadgitlab-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.rb12
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