From 5bd59e0d08acfffc38ca1fb24192b4e50dff3791 Mon Sep 17 00:00:00 2001 From: David Radcliffe Date: Thu, 4 Apr 2019 18:37:43 -0400 Subject: [PATCH 1/2] show downloads and license information for yanked versions too --- app/views/rubygems/_aside.html.erb | 35 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/app/views/rubygems/_aside.html.erb b/app/views/rubygems/_aside.html.erb index 4fe0825a92b..ccaed18b22f 100644 --- a/app/views/rubygems/_aside.html.erb +++ b/app/views/rubygems/_aside.html.erb @@ -3,18 +3,16 @@ <%= render partial: "rubygems/github_button", locals: { github_link: github_link } %> <% end %> - <% if @latest_version.indexed %> -
-

- <%= t('stats.index.total_downloads') %> - <%= number_with_delimiter(@rubygem.downloads) %> -

-

- <%= t('.downloads_for_this_version') %> - <%= number_with_delimiter(@latest_version.downloads_count) %> -

-
- <% end %> +
+

+ <%= t('stats.index.total_downloads') %> + <%= number_with_delimiter(@rubygem.downloads) %> +

+

+ <%= t('.downloads_for_this_version') %> + <%= number_with_delimiter(@latest_version.downloads_count) %> +

+
<% if @latest_version.indexed %>

@@ -33,14 +31,15 @@ =

-

- <%= pluralized_licenses_header @latest_version %>: - -

<%= formatted_licenses @latest_version.licenses %>

-
-

<% end %> +

+ <%= pluralized_licenses_header @latest_version %>: + +

<%= formatted_licenses @latest_version.licenses %>

+
+

+

<%= t('.required_ruby_version') %>: From 7a927d738beb3aedc703e50e0dcabb25acf54f5f Mon Sep 17 00:00:00 2001 From: David Radcliffe Date: Thu, 4 Apr 2019 18:47:59 -0400 Subject: [PATCH 2/2] show yanked version downloads in api --- app/controllers/api/v1/downloads_controller.rb | 2 +- test/functional/api/v1/downloads_controller_test.rb | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/v1/downloads_controller.rb b/app/controllers/api/v1/downloads_controller.rb index 3f42dfef517..1c63a3259a6 100644 --- a/app/controllers/api/v1/downloads_controller.rb +++ b/app/controllers/api/v1/downloads_controller.rb @@ -11,7 +11,7 @@ def index def show full_name = params[:id] version = Version.find_by(full_name: full_name) - if version && !version.yanked? + if version data = { total_downloads: GemDownload.count_for_rubygem(version.rubygem_id), version_downloads: GemDownload.count_for_version(version.id) diff --git a/test/functional/api/v1/downloads_controller_test.rb b/test/functional/api/v1/downloads_controller_test.rb index 6b9127aa1f3..67adb639474 100644 --- a/test/functional/api/v1/downloads_controller_test.rb +++ b/test/functional/api/v1/downloads_controller_test.rb @@ -97,13 +97,7 @@ def self.should_respond_to(format, to_meth = :to_s) get_show(@version) end - should "return a 404" do - assert_response :not_found - end - - should "say gem could not be found" do - assert_equal "This rubygem could not be found.", @response.body - end + should respond_with :success end context "On GET to all" do