chore(admin): remove legal approval step from UI workflow
This commit is contained in:
parent
88b2ee1d01
commit
da269d08f1
4 changed files with 3 additions and 46 deletions
|
|
@ -38,7 +38,6 @@ from .repositories import (
|
||||||
list_runs,
|
list_runs,
|
||||||
list_sources,
|
list_sources,
|
||||||
set_article_image_decision,
|
set_article_image_decision,
|
||||||
set_article_legal_review,
|
|
||||||
upsert_article,
|
upsert_article,
|
||||||
update_feed,
|
update_feed,
|
||||||
update_source,
|
update_source,
|
||||||
|
|
@ -185,7 +184,7 @@ def _classify_publish_error(error_message: str | None) -> tuple[str, str]:
|
||||||
if not text.strip():
|
if not text.strip():
|
||||||
return "ok", "-"
|
return "ok", "-"
|
||||||
if "rechtsfreigabe fehlt" in text or "hauptbild nicht gesetzt" in text or "status ist nicht" in text:
|
if "rechtsfreigabe fehlt" in text or "hauptbild nicht gesetzt" in text or "status ist nicht" in text:
|
||||||
return "policy", "Artikelvoraussetzungen im UI prüfen (Status/Rechtsfreigabe/Hauptbild)."
|
return "policy", "Artikelvoraussetzungen im UI prüfen (Status/Hauptbild)."
|
||||||
if "401" in text or "403" in text or "authorization" in text or "forbidden" in text or "unauthorized" in text:
|
if "401" in text or "403" in text or "authorization" in text or "forbidden" in text or "unauthorized" in text:
|
||||||
return "auth", "WordPress Nutzer/App-Passwort prüfen."
|
return "auth", "WordPress Nutzer/App-Passwort prüfen."
|
||||||
if "404" in text and ("media" in text or "posts" in text or "wp-json" in text):
|
if "404" in text and ("media" in text or "posts" in text or "wp-json" in text):
|
||||||
|
|
@ -245,13 +244,6 @@ def _legal_checklist(article: dict, feed: dict | None) -> list[dict[str, str]]:
|
||||||
"value": feed.get("source_risk_level") if feed else "-",
|
"value": feed.get("source_risk_level") if feed else "-",
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
checks.append(
|
|
||||||
{
|
|
||||||
"label": "Manuelle Rechtsfreigabe",
|
|
||||||
"status": "ok" if int(article.get("legal_checked", 0)) == 1 else "missing",
|
|
||||||
"value": article.get("legal_checked_at") or "-",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
image_review = meta.get("image_review") if isinstance(meta.get("image_review"), dict) else {}
|
image_review = meta.get("image_review") if isinstance(meta.get("image_review"), dict) else {}
|
||||||
selected_image = image_review.get("selected_url") if isinstance(image_review.get("selected_url"), str) else None
|
selected_image = image_review.get("selected_url") if isinstance(image_review.get("selected_url"), str) else None
|
||||||
checks.append(
|
checks.append(
|
||||||
|
|
@ -666,19 +658,6 @@ def admin_image_proxy(request: Request, url: str):
|
||||||
return Response(content=body, media_type=content_type)
|
return Response(content=body, media_type=content_type)
|
||||||
|
|
||||||
|
|
||||||
@router.post("/admin/articles/{article_id}/legal-review")
|
|
||||||
def admin_article_legal_review(request: Request, article_id: int, approved: str = Form("0"), note: str = Form("")):
|
|
||||||
user = _admin_user(request)
|
|
||||||
if not user:
|
|
||||||
return RedirectResponse(url="/admin/login", status_code=303)
|
|
||||||
|
|
||||||
is_approved = approved == "1"
|
|
||||||
ok = set_article_legal_review(article_id, approved=is_approved, note=note or None, actor=user)
|
|
||||||
if not ok:
|
|
||||||
return _dashboard_redirect(msg=f"Artikel #{article_id} nicht gefunden", msg_type="error")
|
|
||||||
return RedirectResponse(url=f"/admin/articles/{article_id}", status_code=303)
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/admin/sources/create")
|
@router.post("/admin/sources/create")
|
||||||
def admin_create_source(
|
def admin_create_source(
|
||||||
request: Request,
|
request: Request,
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<h2>Rechts-Checkliste</h2>
|
<h2>Checkliste</h2>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Kriterium</th><th>Status</th><th>Wert</th></tr>
|
<tr><th>Kriterium</th><th>Status</th><th>Wert</th></tr>
|
||||||
|
|
@ -173,27 +173,6 @@
|
||||||
<p class="subtle">Dieser Text wird für den WordPress-Entwurf verwendet, falls vorhanden.</p>
|
<p class="subtle">Dieser Text wird für den WordPress-Entwurf verwendet, falls vorhanden.</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="card">
|
|
||||||
<h2>Rechtsfreigabe</h2>
|
|
||||||
<p><strong>Freigabe:</strong>
|
|
||||||
{% if article.legal_checked %}
|
|
||||||
<span class="badge ok">Freigegeben</span>
|
|
||||||
{% else %}
|
|
||||||
<span class="badge bad">Nicht freigegeben</span>
|
|
||||||
{% endif %}
|
|
||||||
</p>
|
|
||||||
<p><strong>Zeitpunkt:</strong> {{ article.legal_checked_at or "-" }}</p>
|
|
||||||
<p><strong>Notiz:</strong> {{ article.legal_note or "-" }}</p>
|
|
||||||
<form method="post" action="/admin/articles/{{ article.id }}/legal-review" class="row">
|
|
||||||
<select name="approved">
|
|
||||||
<option value="1">Freigeben</option>
|
|
||||||
<option value="0">Zurücksetzen</option>
|
|
||||||
</select>
|
|
||||||
<input name="note" placeholder="Rechtsnotiz" />
|
|
||||||
<button type="submit">Speichern</button>
|
|
||||||
</form>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="card">
|
<section class="card">
|
||||||
<h2>Status ändern</h2>
|
<h2>Status ändern</h2>
|
||||||
{% if article.status_ui in ["new", "rewrite"] %}
|
{% if article.status_ui in ["new", "rewrite"] %}
|
||||||
|
|
|
||||||
|
|
@ -258,7 +258,6 @@
|
||||||
</td>
|
</td>
|
||||||
<td><span class="badge">{{ a.status_ui }}</span></td>
|
<td><span class="badge">{{ a.status_ui }}</span></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="subtle">Legal: {{ "OK" if a.legal_checked else "offen" }}</div>
|
|
||||||
<div class="subtle">Publish: {{ "bereit" if a.publish_ready else "blockiert" }}</div>
|
<div class="subtle">Publish: {{ "bereit" if a.publish_ready else "blockiert" }}</div>
|
||||||
{% if not a.publish_ready and a.publish_blockers %}
|
{% if not a.publish_ready and a.publish_blockers %}
|
||||||
<div class="subtle">{{ a.publish_blockers|join(", ") }}</div>
|
<div class="subtle">{{ a.publish_blockers|join(", ") }}</div>
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ class TestAdminUi(unittest.TestCase):
|
||||||
res = self.client.get(f"/admin/articles/{article_id}", follow_redirects=True)
|
res = self.client.get(f"/admin/articles/{article_id}", follow_redirects=True)
|
||||||
self.assertEqual(res.status_code, 200)
|
self.assertEqual(res.status_code, 200)
|
||||||
self.assertIn("Artikel-Detail", res.text)
|
self.assertIn("Artikel-Detail", res.text)
|
||||||
self.assertIn("Rechts-Checkliste", res.text)
|
self.assertIn("Checkliste", res.text)
|
||||||
|
|
||||||
decision = self.client.post(
|
decision = self.client.post(
|
||||||
f"/admin/articles/{article_id}/images/decision",
|
f"/admin/articles/{article_id}/images/decision",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue