fix(FastAPI): display VCS note when flagging a VCS package

Closes: #131

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-15 16:15:53 -07:00
parent 71b3f781f7
commit 2d46811c45
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
3 changed files with 44 additions and 0 deletions

View file

@ -568,6 +568,15 @@ msgstr ""
msgid "Flag Package Out-Of-Date" msgid "Flag Package Out-Of-Date"
msgstr "" msgstr ""
#: templates/packages/flag.html
msgid "This seems to be a VCS package. Please do %snot%s flag "
"it out-of-date if the package version in the AUR does "
"not match the most recent commit. Flagging this package "
"should only be done if the sources moved or changes in "
"the PKGBUILD are required because of recent upstream "
"changes."
msgstr ""
#: html/pkgflag.php #: html/pkgflag.php
#, php-format #, php-format
msgid "" msgid ""

View file

@ -18,6 +18,20 @@
{% endfor %} {% endfor %}
</ul> </ul>
{% if pkgbase.Name.endswith(('-cvs', '-svn', '-git', '-hg', '-bzr', '-darcs')) %}
<p class="error">
{# TODO: This error is not yet translated. #}
{{
"This seems to be a VCS package. Please do %snot%s flag "
"it out-of-date if the package version in the AUR does "
"not match the most recent commit. Flagging this package "
"should only be done if the sources moved or changes in "
"the PKGBUILD are required because of recent upstream "
"changes." | tr | format("<strong>", "</strong>") | safe
}}
</p>
{% endif %}
<p> <p>
{{ {{
"Please do %snot%s use this form to report bugs. " "Please do %snot%s use this form to report bugs. "

View file

@ -1762,6 +1762,27 @@ def test_pkgbase_flag(client: TestClient, user: User, maintainer: User,
assert pkgbase.Flagger is None assert pkgbase.Flagger is None
def test_pkgbase_flag_vcs(client: TestClient, user: User, package: Package):
# Morph our package fixture into a VCS package (-git).
with db.begin():
package.PackageBase.Name += "-git"
package.Name += "-git"
cookies = {"AURSID": user.login(Request(), "testPassword")}
with client as request:
resp = request.get(f"/pkgbase/{package.PackageBase.Name}/flag",
cookies=cookies)
assert resp.status_code == int(HTTPStatus.OK)
expected = ("This seems to be a VCS package. Please do "
"<strong>not</strong> flag it out-of-date if the package "
"version in the AUR does not match the most recent commit. "
"Flagging this package should only be done if the sources "
"moved or changes in the PKGBUILD are required because of "
"recent upstream changes.")
assert expected in resp.text
def test_pkgbase_notify(client: TestClient, user: User, package: Package): def test_pkgbase_notify(client: TestClient, user: User, package: Package):
pkgbase = package.PackageBase pkgbase = package.PackageBase