Skip to content

Commit 8bf1b85

Browse files
justinddanielsimi
authored andcommitted
Build trusted publisher filter
1 parent 46ff0a3 commit 8bf1b85

17 files changed

Lines changed: 78 additions & 2 deletions

File tree

app/models/concerns/rubygem_searchable.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module RubygemSearchable
2525
suggest: { type: "completion", contexts: { name: "yanked", type: "category" } },
2626
yanked: { type: "boolean" },
2727
downloads: { type: "long" },
28-
updated: { type: "date" }
28+
updated: { type: "date" },
29+
trusted_publisher: { type: "boolean" }
2930
}
3031
}
3132
scope :search_import, -> { includes(:linkset, :gem_download, :most_recent_version, :versions, :latest_version) }
@@ -43,6 +44,7 @@ def search_data # rubocop:disable Metrics/MethodLength
4344
version_downloads: latest_version&.downloads_count,
4445
platform: latest_version&.platform,
4546
authors: latest_version&.authors,
47+
trusted_publisher: latest_version&.pushed_by_trusted_publisher?,
4648
info: latest_version&.info,
4749
licenses: latest_version&.licenses,
4850
metadata: latest_version&.metadata,

app/models/version.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,10 @@ def gem_file_name
427427
"#{full_name}.gem"
428428
end
429429

430+
def pushed_by_trusted_publisher?
431+
pusher_api_key&.trusted_publisher? ? true : false
432+
end
433+
430434
private
431435

432436
def update_prerelease

app/views/searches/advanced.html.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,8 @@
3232

3333
<dt><%= label_tag :updated, t(".updated"), class: "form__label" %></dt>
3434
<dd><%= text_field_tag :updated, "", placeholder: ">#{1.week.ago.strftime('%F')}", class: "form__input", pattern: "\\s*(<=?|>=?)?[\\d-]+\\s*", data: { search_target: "attribute", action: "input->search#input keydown.enter->search#submit" } %></dd>
35+
36+
<dt><%= label_tag :trusted_publisher, t(".trusted_publisher"), class: "form__label" %></dt>
37+
<dd><%= text_field_tag :trusted_publisher, "", placeholder: "true", class: "form__input", pattern: "true|false", data: { search_target: "attribute", action: "input->search#input keydown.enter->search#submit" } %></dd>
3538
</dl>
3639
</div>

config/locales/de.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,7 @@ de:
840840
summary:
841841
description:
842842
downloads:
843+
trusted_publisher:
843844
updated:
844845
yanked:
845846
show:

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ en:
761761
summary: Summary
762762
description: Description
763763
downloads: Downloads
764+
trusted_publisher: Trusted Publisher
764765
updated: Updated
765766
yanked: Yanked
766767
show:

config/locales/es.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ es:
867867
summary: Resumen
868868
description: Descripción
869869
downloads: Descargas
870+
trusted_publisher:
870871
updated: Actualizada
871872
yanked: Borrada
872873
show:

config/locales/fr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ fr:
798798
summary: Sommaire
799799
description: Description
800800
downloads: Téléchargements
801+
trusted_publisher:
801802
updated: Mis à jour
802803
yanked:
803804
show:

config/locales/ja.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,7 @@ ja:
770770
summary: 概要
771771
description: 説明
772772
downloads: ダウンロード数
773+
trusted_publisher:
773774
updated: 更新日
774775
yanked: ヤンク済み
775776
show:

config/locales/nl.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,7 @@ nl:
752752
summary:
753753
description:
754754
downloads:
755+
trusted_publisher:
755756
updated:
756757
yanked:
757758
show:

config/locales/pt-BR.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,7 @@ pt-BR:
776776
summary:
777777
description:
778778
downloads:
779+
trusted_publisher:
779780
updated:
780781
yanked:
781782
show:

0 commit comments

Comments
 (0)