Skip to content

Move submit malware report button out of include #17924

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

Merged
merged 3 commits into from
Apr 15, 2025
Merged
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
8 changes: 0 additions & 8 deletions tests/unit/packaging/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,14 +449,6 @@ def test_unknown_publisher(self, github_attestation):
)


class TestReportMalwareButton:
def test_report_malware_button(self):
project = pretend.stub()
assert views.includes_submit_malware_observation(project, pretend.stub()) == {
"project": project
}


class TestProjectSubmitMalwareObservation:
def test_get_render_form(self, pyramid_request):
project = pretend.stub()
Expand Down
7 changes: 0 additions & 7 deletions tests/unit/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ def add_redirect_rule(*args, **kwargs):
traverse="/{user_name}",
domain=warehouse,
),
pretend.call(
"includes.submit_malware_report",
"/_includes/authed/submit-malware-report/{project_name}",
factory="warehouse.packaging.models:ProjectFactory",
traverse="/{project_name}",
domain=warehouse,
),
pretend.call("classifiers", "/classifiers/", domain=warehouse),
pretend.call("search", "/search/", domain=warehouse),
pretend.call("stats", "/stats/", accept="text/html", domain=warehouse),
Expand Down
76 changes: 38 additions & 38 deletions warehouse/locale/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ msgstr ""
msgid "Provide an Inspector link to specific lines of code."
msgstr ""

#: warehouse/packaging/views.py:353
#: warehouse/packaging/views.py:342
msgid "Your report has been recorded. Thank you for your help."
msgstr ""

Expand Down Expand Up @@ -976,8 +976,8 @@ msgstr ""
#: warehouse/templates/manage/project/release.html:194
#: warehouse/templates/manage/project/releases.html:140
#: warehouse/templates/manage/project/releases.html:179
#: warehouse/templates/packaging/detail.html:417
#: warehouse/templates/packaging/detail.html:437
#: warehouse/templates/packaging/detail.html:419
#: warehouse/templates/packaging/detail.html:439
#: warehouse/templates/pages/classifiers.html:25
#: warehouse/templates/pages/help.html:20
#: warehouse/templates/pages/help.html:230
Expand Down Expand Up @@ -3201,10 +3201,6 @@ msgstr ""
msgid "Classifiers"
msgstr ""

#: warehouse/templates/includes/packaging/submit-malware-report.html:18
msgid "Report project as malware"
msgstr ""

#: warehouse/templates/manage/account.html:33
#: warehouse/templates/manage/unverified-account.html:30
msgid "Verified*"
Expand Down Expand Up @@ -6295,28 +6291,28 @@ msgid "Back to projects"
msgstr ""

#: warehouse/templates/manage/project/manage_project_base.html:70
#: warehouse/templates/packaging/detail.html:302
#: warehouse/templates/packaging/detail.html:304
msgid "This project has been quarantined."
msgstr ""

#: warehouse/templates/manage/project/manage_project_base.html:72
#: warehouse/templates/packaging/detail.html:304
#: warehouse/templates/packaging/detail.html:306
msgid ""
"PyPI Admins need to review this project before it can be restored. While "
"in quarantine, the project is not installable by clients, and cannot be "
"being modified by its maintainers."
msgstr ""

#: warehouse/templates/manage/project/manage_project_base.html:79
#: warehouse/templates/packaging/detail.html:311
#: warehouse/templates/packaging/detail.html:313
#, python-format
msgid ""
"Read more in the <a href=\"%(href)s\">project in quarantine</a> help "
"article."
msgstr ""

#: warehouse/templates/manage/project/manage_project_base.html:86
#: warehouse/templates/packaging/detail.html:318
#: warehouse/templates/packaging/detail.html:320
msgid "This project has been archived."
msgstr ""

Expand Down Expand Up @@ -7284,114 +7280,118 @@ msgid "Navigation"
msgstr ""

#: warehouse/templates/packaging/detail.html:233
#: warehouse/templates/packaging/detail.html:267
#: warehouse/templates/packaging/detail.html:269
#, python-format
msgid "Navigation for %(project)s"
msgstr ""

#: warehouse/templates/packaging/detail.html:236
#: warehouse/templates/packaging/detail.html:270
#: warehouse/templates/packaging/detail.html:272
msgid "Project description. Focus will be moved to the description."
msgstr ""

#: warehouse/templates/packaging/detail.html:238
#: warehouse/templates/packaging/detail.html:272
#: warehouse/templates/packaging/detail.html:332
#: warehouse/templates/packaging/detail.html:274
#: warehouse/templates/packaging/detail.html:334
msgid "Project description"
msgstr ""

#: warehouse/templates/packaging/detail.html:242
#: warehouse/templates/packaging/detail.html:282
#: warehouse/templates/packaging/detail.html:284
msgid "Release history. Focus will be moved to the history panel."
msgstr ""

#: warehouse/templates/packaging/detail.html:244
#: warehouse/templates/packaging/detail.html:284
#: warehouse/templates/packaging/detail.html:354
#: warehouse/templates/packaging/detail.html:286
#: warehouse/templates/packaging/detail.html:356
msgid "Release history"
msgstr ""

#: warehouse/templates/packaging/detail.html:249
#: warehouse/templates/packaging/detail.html:289
#: warehouse/templates/packaging/detail.html:291
msgid "Download files. Focus will be moved to the project files."
msgstr ""

#: warehouse/templates/packaging/detail.html:251
#: warehouse/templates/packaging/detail.html:291
#: warehouse/templates/packaging/detail.html:416
#: warehouse/templates/packaging/detail.html:293
#: warehouse/templates/packaging/detail.html:418
msgid "Download files"
msgstr ""

#: warehouse/templates/packaging/detail.html:276
msgid "Project details. Focus will be moved to the project details."
#: warehouse/templates/packaging/detail.html:264
msgid "Report project as malware"
msgstr ""

#: warehouse/templates/packaging/detail.html:278
#: warehouse/templates/packaging/detail.html:346
msgid "Project details. Focus will be moved to the project details."
msgstr ""

#: warehouse/templates/packaging/detail.html:280
#: warehouse/templates/packaging/detail.html:348
msgid "Project details"
msgstr ""

#: warehouse/templates/packaging/detail.html:320
#: warehouse/templates/packaging/detail.html:322
msgid ""
"The maintainers of this project have marked this project as archived. No "
"new releases are expected."
msgstr ""

#: warehouse/templates/packaging/detail.html:328
#: warehouse/templates/packaging/detail.html:403
#: warehouse/templates/packaging/detail.html:330
#: warehouse/templates/packaging/detail.html:405
msgid "Reason this release was yanked:"
msgstr ""

#: warehouse/templates/packaging/detail.html:339
#: warehouse/templates/packaging/detail.html:341
msgid "The author of this package has not provided a project description"
msgstr ""

#: warehouse/templates/packaging/detail.html:356
#: warehouse/templates/packaging/detail.html:358
msgid "Release notifications"
msgstr ""

#: warehouse/templates/packaging/detail.html:357
#: warehouse/templates/packaging/detail.html:359
msgid "RSS feed"
msgstr ""

#: warehouse/templates/packaging/detail.html:369
#: warehouse/templates/packaging/detail.html:371
msgid "This version"
msgstr ""

#: warehouse/templates/packaging/detail.html:389
#: warehouse/templates/packaging/detail.html:391
msgid "pre-release"
msgstr ""

#: warehouse/templates/packaging/detail.html:394
#: warehouse/templates/packaging/detail.html:396
msgid "yanked"
msgstr ""

#: warehouse/templates/packaging/detail.html:417
#: warehouse/templates/packaging/detail.html:419
#, python-format
msgid ""
"Download the file for your platform. If you're not sure which to choose, "
"learn more about <a href=\"%(href)s\" title=\"%(title)s\" "
"target=\"_blank\" rel=\"noopener\">installing packages</a>."
msgstr ""

#: warehouse/templates/packaging/detail.html:420
#: warehouse/templates/packaging/detail.html:422
msgid "Source Distribution"
msgid_plural "Source Distributions"
msgstr[0] ""
msgstr[1] ""

#: warehouse/templates/packaging/detail.html:436
#: warehouse/templates/packaging/detail.html:438
msgid "No source distribution files available for this release."
msgstr ""

#: warehouse/templates/packaging/detail.html:437
#: warehouse/templates/packaging/detail.html:439
#, python-format
msgid ""
"See tutorial on <a href=\"%(href)s\" title=\"%(title)s\" "
"target=\"_blank\" rel=\"noopener\">generating distribution archives</a>."
msgstr ""

#: warehouse/templates/packaging/detail.html:444
#: warehouse/templates/packaging/detail.html:446
msgid "Built Distribution"
msgid_plural "Built Distributions"
msgstr[0] ""
Expand Down
11 changes: 0 additions & 11 deletions warehouse/packaging/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,6 @@ def edit_project_button(project, request):
return {"project": project}


@view_config(
context=Project,
has_translations=True,
renderer="includes/packaging/submit-malware-report.html",
route_name="includes.submit_malware_report",
uses_session=True,
)
def includes_submit_malware_observation(project, request):
return {"project": project}


@view_config(
context=Project,
has_translations=True,
Expand Down
7 changes: 0 additions & 7 deletions warehouse/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ def includeme(config):
traverse="/{user_name}",
domain=warehouse,
)
config.add_route(
"includes.submit_malware_report",
"/_includes/authed/submit-malware-report/{project_name}",
factory="warehouse.packaging.models:ProjectFactory",
traverse="/{project_name}",
domain=warehouse,
)

# Classifier Routes
config.add_route("classifiers", "/classifiers/", domain=warehouse)
Expand Down

This file was deleted.

8 changes: 5 additions & 3 deletions warehouse/templates/packaging/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ <h3 class="sidebar-section__title">{% trans %}Navigation{% endtrans %}</h3>
{% include "warehouse:templates/includes/packaging/project-data.html" %}
{% set include_sponsor_logos = project.organization.orgtype != OrganizationType.Company %}
{% include "warehouse:templates/includes/sidebar-sponsor-logo.html" %}
{% csi request.route_url("includes.submit_malware_report", project_name=project.name) %}
{% endcsi %}

<div class="sidebar-section">
<a class="button button--full-width button--warning"
href="{{ request.route_url("packaging.project.submit_malware_observation", name=project.name) }}"
role="button">{% trans %}Report project as malware{% endtrans %}</a>
</div>
</div>
<div class="vertical-tabs__panel">
<!-- mobile menu -->
Expand Down