mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(FastAPI): add /requests/{id}/close (get, post)
Changes from PHP: - If a user submits a POST request with an invalid reason, they are returned back to the closure form with a BAD_REQUEST status. - Now, users which created a PackageRequest have the ability to close their own. - Form action has been changed to `/requests/{id}/close`. Closes https://gitlab.archlinux.org/archlinux/aurweb/-/issues/20 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
1c031638c6
commit
f6141ff177
3 changed files with 196 additions and 2 deletions
60
templates/requests/close.html
Normal file
60
templates/requests/close.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
{% extends "partials/layout.html" %}
|
||||
|
||||
{% block pageContent %}
|
||||
<div class="box">
|
||||
<h2>{{ "Close Request" | tr }}: {{ pkgreq.PackageBaseName }}</h2>
|
||||
|
||||
<p>
|
||||
{{
|
||||
"Use this form to close the request for package base %s%s%s."
|
||||
| tr | format("<strong>", pkgreq.PackageBaseName, "</strong>")
|
||||
| safe
|
||||
}}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<em>{{ "Note" | tr }}:</em>
|
||||
{{
|
||||
"The comments field can be left empty. However, it is highly "
|
||||
"recommended to add a comment when rejecting a request."
|
||||
| tr
|
||||
}}
|
||||
</p>
|
||||
|
||||
<form action="/requests/{{ pkgreq.ID }}/close" method="post">
|
||||
<fieldset>
|
||||
<p>
|
||||
<label for="id_reason">{{ "Reason" | tr }}:</label>
|
||||
<select id="id_reason" name="reason">
|
||||
{# Value 2 == "Accepted" status.
|
||||
See aurweb.models.package_request. #}
|
||||
{% if request.user.is_elevated() %}
|
||||
<option value="2">
|
||||
{{ "Accepted" | tr }}
|
||||
</option>
|
||||
{% endif %}
|
||||
{# Value 3 == "Rejected" status.
|
||||
See aurweb.models.package_request. #}
|
||||
<option value="3">
|
||||
{{ "Rejected" | tr }}
|
||||
</option>
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="id_comments">{{ "Comments" | tr }}:</label>
|
||||
<textarea id="id_comments" name="comments"
|
||||
rows="5" cols="50"></textarea>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button class="button" type="submit">
|
||||
{{ "Close Request" | tr }}
|
||||
</button>
|
||||
</p>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue