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

Add title text for verified links, test for verified link #4538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/helpers/rubygems_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ def formatted_licenses(license_names)
end

def link_to_page(id, url, verified: false)
return if url.blank?

classes = %w[gem__link t-list__item]
classes << "gem__link__verified" if verified
link_to(t("rubygems.aside.links.#{id}"), url, rel: "nofollow", class: classes, id: id) if url.present?
if verified
classes << "gem__link__verified"
title = t("rubygems.aside.link_verified")
end

link_to(t("rubygems.aside.links.#{id}"), url, rel: "nofollow", class: classes, id:, title:)
end

def link_to_directory
Expand Down
1 change: 1 addition & 0 deletions config/locales/de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,7 @@ de:
required_rubygems_version:
requires_mfa:
released_with_mfa:
link_verified:
links:
badge: Abzeichen
bugs: Bug Tracker
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ en:
required_rubygems_version: Required Rubygems Version
requires_mfa: New versions require MFA
released_with_mfa: Version published with MFA
link_verified: ✓ indicates a verified backlink
links:
badge: Badge
bugs: Bug Tracker
Expand Down
1 change: 1 addition & 0 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ es:
required_rubygems_version: Versión de Rubygems requerida
requires_mfa: Nuevas versiones requieren AMF
released_with_mfa: Versión publicada con AMF
link_verified:
links:
badge: Badge
bugs: Seguimiento de Bugs
Expand Down
1 change: 1 addition & 0 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ fr:
required_rubygems_version:
requires_mfa:
released_with_mfa:
link_verified:
links:
badge: Badge
bugs: Suivi de bugs
Expand Down
1 change: 1 addition & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ ja:
required_rubygems_version: 必要なRubyGemsのバージョン
requires_mfa: 新しいバージョンはMFAを必要とします
released_with_mfa: MFAで投稿されたバージョン
link_verified:
links:
badge: バッジ
bugs: バグトラッカー
Expand Down
1 change: 1 addition & 0 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ nl:
required_rubygems_version: Required Rubygems Version
requires_mfa:
released_with_mfa:
link_verified:
links:
badge: Badge
bugs: Bug-tracker
Expand Down
1 change: 1 addition & 0 deletions config/locales/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,7 @@ pt-BR:
required_rubygems_version: Versão Requerida do RubyGems
requires_mfa:
released_with_mfa:
link_verified:
links:
badge: Badge
bugs:
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ zh-CN:
required_rubygems_version: 需要的 RubyGems 版本
requires_mfa: 新的版本需要开启多因素验证
released_with_mfa: 使用多因素验证发布的版本
link_verified:
links:
badge: 徽章
bugs: Bug 追踪
Expand Down
1 change: 1 addition & 0 deletions config/locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ zh-TW:
required_rubygems_version: RubyGems 版本需求
requires_mfa:
released_with_mfa:
link_verified:
links:
badge: 徽章
bugs: Bug 追蹤
Expand Down
10 changes: 10 additions & 0 deletions test/integration/gems_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ class GemsSystemTest < SystemTest
assert page.has_selector?(".github-btn")
end

test "shows verified link when hompage_uri is set and verified" do
github_link = "http://github.com/user/project"
version = create(:version, number: "3.0.1", rubygem: @rubygem, metadata: { "homepage_uri" => github_link })
version.rubygem.link_verifications.create!(uri: github_link, last_verified_at: 1.day.ago)

visit rubygem_path(@rubygem.slug)

assert page.has_selector?(".gem__link__verified")
end

test "shows github link when homepage_uri is set" do
github_link = "http://github.com/user/project"
create(:version, number: "3.0.1", rubygem: @rubygem, metadata: { "homepage_uri" => github_link })
Expand Down
Loading