feat: add Support section to Dashboard

Adds the "Support" section (displayed on "Home") to the "Dashboard" page as well.

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-01-14 13:12:33 +01:00
parent 2150f8bc19
commit f6c4891415
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
4 changed files with 96 additions and 78 deletions

View file

@ -62,6 +62,9 @@
{% endwith %}
{% endif %}
</div>
<div id="news">
{% include 'partials/support.html' %}
</div>
<!-- Bootstrap typeahead for the homepage. -->
<script type="text/javascript" src="/static/js/typeahead-home.js"></script>

View file

@ -24,71 +24,7 @@
<p class="readmore"><a href="https://wiki.archlinux.org/title/AUR">{% trans %}Learn more...{% endtrans %}</a></p>
</div>
<div id="news">
<h3><a>{% trans %}Support{% endtrans %}</a><span class="arrow"></span></h3>
<h4>{% trans %}Package Requests{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "There are three types of requests that can be filed in the %sPackage Actions%s box on the package details page:"
| tr
| format("<var>", "</var>")
| safe
}}
</p>
<ul>
<li><em>{% trans %}Orphan Request{% endtrans %}</em>: {% trans %}Request a package to be disowned, e.g. when the maintainer is inactive and the package has been flagged out-of-date for a long time.{% endtrans %}</li>
<li><em>{% trans %}Deletion Request{% endtrans %}</em>: {%trans %}Request a package to be removed from the Arch User Repository. Please do not use this if a package is broken and can be fixed easily. Instead, contact the package maintainer and file orphan request if necessary.{% endtrans %}</li>
<li><em>{% trans %}Merge Request{% endtrans %}</em>: {% trans %}Request a package to be merged into another one. Can be used when a package needs to be renamed or replaced by a split package.{% endtrans %}</li>
</ul>
<p>
{{ "If you want to discuss a request, you can use the %saur-requests%s mailing list. However, please do not use that list to file requests."
| tr
| format('<a href="https://lists.archlinux.org/mailman3/lists/aur-requests.lists.archlinux.org/">', "</a>")
| safe
}}
</p>
</div>
<h4>{% trans %}Submitting Packages{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "Git over SSH is now used to submit packages to the AUR. See the %sSubmitting packages%s section of the Arch User Repository ArchWiki page for more details."
| tr
| format('<a href="https://wiki.archlinux.org/title/Arch_User_Repository#Submitting_packages">', "</a>")
| safe
}}
</p>
{% if ssh_fingerprints %}
<p>
{% trans %}The following SSH fingerprints are used for the AUR:{% endtrans %}
<p>
<ul>
{% for keytype in ssh_fingerprints %}
<li><code>{{ keytype }}</code>: <code>{{ ssh_fingerprints[keytype] }}</code>
{% endfor %}
</ul>
{% endif %}
</div>
<h4>{% trans %}Discussion{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "General discussion regarding the Arch User Repository (AUR) and Trusted User structure takes place on %saur-general%s. For discussion relating to the development of the AUR web interface, use the %saur-dev%s mailing list."
| tr
| format('<a href="https://lists.archlinux.org/mailman3/lists/aur-general.lists.archlinux.org/">', "</a>",
'<a href="https://lists.archlinux.org/mailman3/lists/aur-dev.lists.archlinux.org/">', "</a>")
| safe
}}
<p>
</div>
<h4>{% trans %}Bug Reporting{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "If you find a bug in the AUR web interface, please fill out a bug report on our %sbug tracker%s. Use the tracker to report bugs in the AUR web interface %sonly%s. To report packaging bugs contact the package maintainer or leave a comment on the appropriate package page."
| tr
| format('<a href="https://gitlab.archlinux.org/archlinux/aurweb/-/issues">', "</a>",
"<strong>", "</strong>")
| safe
}}
</p>
</div>
{% include 'partials/support.html' %}
</div>
<!-- Bootstrap typeahead for the homepage. -->

View file

@ -0,0 +1,65 @@
<h3><a>{% trans %}Support{% endtrans %}</a><span class="arrow"></span></h3>
<h4>{% trans %}Package Requests{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "There are three types of requests that can be filed in the %sPackage Actions%s box on the package details page:"
| tr
| format("<var>", "</var>")
| safe
}}
</p>
<ul>
<li><em>{% trans %}Orphan Request{% endtrans %}</em>: {% trans %}Request a package to be disowned, e.g. when the maintainer is inactive and the package has been flagged out-of-date for a long time.{% endtrans %}</li>
<li><em>{% trans %}Deletion Request{% endtrans %}</em>: {%trans %}Request a package to be removed from the Arch User Repository. Please do not use this if a package is broken and can be fixed easily. Instead, contact the package maintainer and file orphan request if necessary.{% endtrans %}</li>
<li><em>{% trans %}Merge Request{% endtrans %}</em>: {% trans %}Request a package to be merged into another one. Can be used when a package needs to be renamed or replaced by a split package.{% endtrans %}</li>
</ul>
<p>
{{ "If you want to discuss a request, you can use the %saur-requests%s mailing list. However, please do not use that list to file requests."
| tr
| format('<a href="https://lists.archlinux.org/mailman3/lists/aur-requests.lists.archlinux.org/">', "</a>")
| safe
}}
</p>
</div>
<h4>{% trans %}Submitting Packages{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "Git over SSH is now used to submit packages to the AUR. See the %sSubmitting packages%s section of the Arch User Repository ArchWiki page for more details."
| tr
| format('<a href="https://wiki.archlinux.org/title/Arch_User_Repository#Submitting_packages">', "</a>")
| safe
}}
</p>
{% if ssh_fingerprints %}
<p>
{% trans %}The following SSH fingerprints are used for the AUR:{% endtrans %}
<p>
<ul>
{% for keytype in ssh_fingerprints %}
<li><code>{{ keytype }}</code>: <code>{{ ssh_fingerprints[keytype] }}</code>
{% endfor %}
</ul>
{% endif %}
</div>
<h4>{% trans %}Discussion{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "General discussion regarding the Arch User Repository (AUR) and Trusted User structure takes place on %saur-general%s. For discussion relating to the development of the AUR web interface, use the %saur-dev%s mailing list."
| tr
| format('<a href="https://lists.archlinux.org/mailman3/lists/aur-general.lists.archlinux.org/">', "</a>",
'<a href="https://lists.archlinux.org/mailman3/lists/aur-dev.lists.archlinux.org/">', "</a>")
| safe
}}
<p>
</div>
<h4>{% trans %}Bug Reporting{% endtrans %}</h4>
<div class="article-content">
<p>
{{ "If you find a bug in the AUR web interface, please fill out a bug report on our %sbug tracker%s. Use the tracker to report bugs in the AUR web interface %sonly%s. To report packaging bugs contact the package maintainer or leave a comment on the appropriate package page."
| tr
| format('<a href="https://gitlab.archlinux.org/archlinux/aurweb/-/issues">', "</a>",
"<strong>", "</strong>")
| safe
}}
</p>
</div>

View file

@ -125,32 +125,46 @@ def test_homepage():
@patch("aurweb.util.get_ssh_fingerprints")
def test_homepage_ssh_fingerprints(get_ssh_fingerprints_mock):
def test_homepage_ssh_fingerprints(get_ssh_fingerprints_mock, user):
fingerprints = {"Ed25519": "SHA256:RFzBCUItH9LZS0cKB5UE6ceAYhBD5C8GeOBip8Z11+4"}
get_ssh_fingerprints_mock.return_value = fingerprints
# without authentication (Home)
with client as request:
response = request.get("/")
# with authentication (Dashboard)
with client as auth_request:
auth_request.cookies = {"AURSID": user.login(Request(), "testPassword")}
auth_response = auth_request.get("/")
for resp in [response, auth_response]:
for key, value in fingerprints.items():
assert key in response.content.decode()
assert value in response.content.decode()
assert key in resp.content.decode()
assert value in resp.content.decode()
assert (
"The following SSH fingerprints are used for the AUR"
in response.content.decode()
in resp.content.decode()
)
@patch("aurweb.util.get_ssh_fingerprints")
def test_homepage_no_ssh_fingerprints(get_ssh_fingerprints_mock):
def test_homepage_no_ssh_fingerprints(get_ssh_fingerprints_mock, user):
get_ssh_fingerprints_mock.return_value = {}
# without authentication (Home)
with client as request:
response = request.get("/")
# with authentication (Dashboard)
with client as auth_request:
auth_request.cookies = {"AURSID": user.login(Request(), "testPassword")}
auth_response = auth_request.get("/")
for resp in [response, auth_response]:
assert (
"The following SSH fingerprints are used for the AUR"
not in response.content.decode()
not in resp.content.decode()
)