mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(routers.trusted_user): fix missing submitter link on /tu/{id}
Closes #235 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
0988415931
commit
ae7621fb54
2 changed files with 12 additions and 4 deletions
|
@ -22,12 +22,15 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set submitted = voteinfo.Submitted | dt | as_timezone(timezone) %}
|
{% set submitted = voteinfo.Submitted | dt | as_timezone(timezone) %}
|
||||||
|
{% set submitter = voteinfo.Submitter.Username %}
|
||||||
|
{% set submitter_uri = "/account/%s" | format(submitter) %}
|
||||||
|
{% set submitter = '<a href="%s">%s</a>' | format(submitter_uri, submitter) %}
|
||||||
{% set end = voteinfo.End | dt | as_timezone(timezone) %}
|
{% set end = voteinfo.End | dt | as_timezone(timezone) %}
|
||||||
<div class="field submitted">
|
<div class="field submitted">
|
||||||
{{
|
{{
|
||||||
"Submitted: %s by %s" | tr
|
"Submitted: %s by %s" | tr
|
||||||
| format(submitted.strftime("%Y-%m-%d %H:%M"),
|
| format(submitted.strftime("%Y-%m-%d %H:%M"), submitter)
|
||||||
voteinfo.Submitter.Username | e)
|
| safe
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
import lxml.etree
|
import lxml.etree
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -477,7 +478,8 @@ def test_tu_proposal_not_found(client, tu_user):
|
||||||
assert response.status_code == int(HTTPStatus.NOT_FOUND)
|
assert response.status_code == int(HTTPStatus.NOT_FOUND)
|
||||||
|
|
||||||
|
|
||||||
def test_tu_running_proposal(client, proposal):
|
def test_tu_running_proposal(client: TestClient,
|
||||||
|
proposal: Tuple[User, User, TUVoteInfo]):
|
||||||
tu_user, user, voteinfo = proposal
|
tu_user, user, voteinfo = proposal
|
||||||
|
|
||||||
# Initiate an authenticated GET request to /tu/{proposal_id}.
|
# Initiate an authenticated GET request to /tu/{proposal_id}.
|
||||||
|
@ -502,8 +504,11 @@ def test_tu_running_proposal(client, proposal):
|
||||||
|
|
||||||
submitted = details.xpath(
|
submitted = details.xpath(
|
||||||
'./div[contains(@class, "submitted")]/text()')[0]
|
'./div[contains(@class, "submitted")]/text()')[0]
|
||||||
assert re.match(r'^Submitted: \d{4}-\d{2}-\d{2} \d{2}:\d{2} by .+$',
|
assert re.match(r'^Submitted: \d{4}-\d{2}-\d{2} \d{2}:\d{2} by$',
|
||||||
submitted.strip()) is not None
|
submitted.strip()) is not None
|
||||||
|
submitter = details.xpath('./div[contains(@class, "submitted")]/a')[0]
|
||||||
|
assert submitter.text.strip() == tu_user.Username
|
||||||
|
assert submitter.attrib["href"] == f"/account/{tu_user.Username}"
|
||||||
|
|
||||||
end = details.xpath('./div[contains(@class, "end")]')[0]
|
end = details.xpath('./div[contains(@class, "end")]')[0]
|
||||||
end_label = end.xpath("./text()")[0]
|
end_label = end.xpath("./text()")[0]
|
||||||
|
|
Loading…
Add table
Reference in a new issue