Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use metadata uri instead of linkset for github links #2316

Merged
merged 2 commits into from Apr 26, 2020

Conversation

sonalkr132
Copy link
Member

We had deprecated Linkset a while back, must have missed updating
these functions. Links fallbacks to Linkset.
Fixes: github button not shown when homepage_uri or source_code_uri
is set.

closes: #2314

@@ -1,6 +1,8 @@
<div class="gem__aside l-col--r--pad">
<% if @rubygem.linkset.present? && github_link = link_to_github(@rubygem) %>
<%= render partial: "rubygems/github_button", locals: { github_link: github_link } %>
<%= "hiiii"%>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @simi. updated.

<% if @rubygem.linkset.present? && github_link = link_to_github(@rubygem) %>
<%= render partial: "rubygems/github_button", locals: { github_link: github_link } %>

<% if github_params = github_params(@rubygem) %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this "shadow" github_params variable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what do you mean by shadow. I want to render following partial if github_params(@rubygem) doesn't return nil. used assignment to avoid calling same again in locals.

Copy link
Member

@simi simi Apr 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github_params is method, but also becomes variable in here after assignment. This emits warning in pure Ruby if I remember well. Maybe not problem for erb.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, yes. It does work for erb. changed var name anyway.

@sonalkr132 sonalkr132 force-pushed the github-links branch 2 times, most recently from f2d6b88 to bd619b1 Compare April 10, 2020 20:18
assert page.has_selector?(".github-btn")
end

test "shows github link when homepage_uri is set" do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth adding a test to validate that there is no Github button when source_code_uri and homepage_uri is not a URL to github.com?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you say this tests the same thing? let me know if you think this needs integration test as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added integration test as well.

We had deprecated Linkset a while back, must have missed updating
these functions. Links fallbacks to Linkset.
Fixes: github button not shown when homepage_uri or source_code_uri
is set.
fixes: NoMethodError: undefined method `metadata_uri_set?' for
nil:NilClass
app/models/links.rb:66:in `block (2 levels) in <class:Links>'
@sonalkr132 sonalkr132 merged commit d850159 into rubygems:master Apr 26, 2020
@sonalkr132 sonalkr132 deleted the github-links branch April 26, 2020 04:53
@sonalkr132 sonalkr132 temporarily deployed to staging April 26, 2020 05:04 Inactive
@sonalkr132 sonalkr132 temporarily deployed to production April 27, 2020 15:16 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Github button does not appear on the gems page
3 participants