Historikk per innlegg i admin, og presisert flytte-avsnitt i README
Redigeringssiden lenker til /admin/history/<id> som lister commits som har rørt innleggets mappe; klikk på en commit viser diffen fargelagt. Samme tilgangsregler som editoren (gjester ser bare egne innlegg). README skiller nå tydelig mellom å kopiere hele data-volumet (ingen nye brukere) og å klone bare innholdsrepoet (brukere må opprettes på nytt). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcEy43fNYpwg6K6oTKakWR
This commit is contained in:
parent
6fef73793f
commit
fa8b980edd
7 changed files with 133 additions and 5 deletions
|
|
@ -162,3 +162,30 @@ def test_no_inline_js_with_content(client, cfg):
|
|||
html = client.get(r.headers["Location"]).text
|
||||
assert "onsubmit=" not in html and "onclick=" not in html
|
||||
assert "Ola's" in html
|
||||
|
||||
|
||||
def test_post_history(client, cfg):
|
||||
post_id = _create_post(client)
|
||||
token = csrf(client)
|
||||
r = client.post(
|
||||
f"/admin/edit/{post_id}",
|
||||
data={"csrf": token, "title": "Hist", "body": "første", "action": "publish"},
|
||||
)
|
||||
pid = r.headers["Location"].split("/admin/edit/")[1]
|
||||
client.post(
|
||||
f"/admin/edit/{pid}",
|
||||
data={"csrf": token, "title": "Hist", "body": "andre", "action": "save"},
|
||||
)
|
||||
|
||||
html = client.get(f"/admin/history/{pid}").text
|
||||
assert "Publiserte: Hist" in html and "Lagret: Hist" in html
|
||||
sha = re.search(r"sha=([0-9a-f]{40})", html).group(1)
|
||||
diff = client.get(f"/admin/history/{pid}?sha={sha}").text
|
||||
assert '<span class="add">+andre</span>' in diff and '<span class="del">-første</span>' in diff
|
||||
assert client.get(f"/admin/history/{pid}?sha=deadbeef").status_code == 404
|
||||
assert client.get(f"/admin/history/{pid}?sha=;rm").status_code == 404
|
||||
|
||||
# Gjest får ikke se eierens historikk
|
||||
client.post("/admin/logout", data={"csrf": token})
|
||||
login(client, "gjest1")
|
||||
assert client.get(f"/admin/history/{pid}").status_code == 403
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue