Visningsnavn og e-post i profil, signatur under innlegg
Alle brukere kan sette visningsnavn og valgfri e-post under Profil i admin. Innlegg avsluttes med «– Visningsnavn», med e-post som mailto- lenke hvis satt. Frontmatter lagrer nå brukernavnet (stabilt), og visningsnavn/e-post slås opp i brukertabellen ved bygging, så en endring gjelder alle innlegg. Eldre innlegg med visningsnavn i author- feltet vises uendret. Brukertabellen migreres automatisk (email). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JcEy43fNYpwg6K6oTKakWR
This commit is contained in:
parent
14bb9f97ab
commit
259465342b
12 changed files with 123 additions and 10 deletions
|
|
@ -314,3 +314,28 @@ def test_base_path_derived_from_site_url(tmp_path):
|
|||
}
|
||||
)
|
||||
assert cfg.base_path == ""
|
||||
|
||||
|
||||
def test_signature_from_profile(client, cfg):
|
||||
post_id = _create_post(client)
|
||||
token = csrf(client)
|
||||
client.post(
|
||||
f"/admin/edit/{post_id}",
|
||||
data={"csrf": token, "title": "Sign", "body": "x", "action": "publish"},
|
||||
)
|
||||
assert "– Ole" in client.get("/sign/").text # visningsnavn fra brukertabellen
|
||||
assert (cfg.content_dir / "posts/sign/index.md").read_text().count('author: "eier"') == 1
|
||||
|
||||
r = client.post(
|
||||
"/admin/profile", data={"csrf": token, "display_name": "Ole M.", "email": "ole@example.no"}
|
||||
)
|
||||
assert r.status_code == 302
|
||||
html = client.get("/sign/").text
|
||||
assert "– Ole M." in html and 'href="mailto:ole@example.no"' in html
|
||||
assert "<dc:creator>Ole M.</dc:creator>" in client.get("/feed.xml").text
|
||||
assert (
|
||||
client.post(
|
||||
"/admin/profile", data={"csrf": token, "display_name": "x", "email": "ikke-epost"}
|
||||
).status_code
|
||||
== 200
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue