Zeige den Bezug zwischen Schreiben und lies eine E-Mail vor dem Uebernehmen.
Deploy Development / deploy (push) Successful in 27s
Test Suite / pytest-backend (push) Successful in 1m10s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Die Liste behaelt die Schreiben dazwischen. Richtung, Absender, Empfaenger und Anhaenge bleiben an der Nachricht erkennbar.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 17:27:17 +02:00
1 parent 97bffc6175
commit f27df3ff35
19 files changed
+1049 -49

No files matched your search

+41
View File
@@ -67,6 +67,7 @@ from app.api.schemas import (
RoomIn,
ScopeIn,
TaskDeadlineIn,
ElementReferenceIn,
TaskDependencyIn,
TaskElementsIn,
SummaryPatch,
@@ -106,8 +107,10 @@ from app.ops import (
grant_access,
link_matter_to_case,
link_task_deadline,
link_element_reference,
link_task_dependency,
set_task_elements,
unlink_element_reference,
unlink_task_dependency,
patch_case,
patch_deadline,
@@ -794,6 +797,8 @@ def post_note(body: NoteIn, principal: Principal = Depends(get_principal), conn:
_ctx_model(body.placement),
body.chapter_id,
body.dates.document_on if body.dates else None,
body.dates.sent_on if body.dates else None,
body.dates.received_on if body.dates else None,
)
element = created["element"]
return _created(
@@ -1100,6 +1105,42 @@ def delete_task_dependency(
return Response(status_code=204)
@router.post("/api/v1/elements/{element_id}/references", status_code=204)
def post_element_reference(
element_id: UUID,
body: ElementReferenceIn,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
link_element_reference(
conn,
principal.account_id,
element_id,
body.refers_to_element_id,
_ctx_model(body.context),
)
return Response(status_code=204)
@router.delete("/api/v1/elements/{element_id}/references/{refers_to_element_id}", status_code=204)
def delete_element_reference(
element_id: UUID,
refers_to_element_id: UUID,
context_kind: str | None = None,
context_id: str | None = None,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
unlink_element_reference(
conn,
principal.account_id,
element_id,
refers_to_element_id,
parse_query_context(context_kind, context_id),
)
return Response(status_code=204)
@router.post("/api/v1/deadlines")
def post_deadline(body: DeadlineIn, principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
deadline = create_deadline(
+17
View File
@@ -205,9 +205,21 @@ class DatesIn(APIModel):
received_on: date | None = None
class MailAttachment(APIModel):
filename: str = Field(min_length=1, max_length=200)
content_type: str | None = Field(default=None, max_length=120)
class ExternalDetail(APIModel):
correspondent: str | None = Field(default=None, max_length=200)
message_from: str | None = Field(default=None, max_length=200)
message_to: str | None = Field(default=None, max_length=500)
message_cc: str | None = Field(default=None, max_length=500)
direction: Literal["in", "out"] | None = None
mailbox: str | None = Field(default=None, max_length=200)
connector_id: UUID | None = None
uid: int | None = Field(default=None, ge=1)
attachments: list[MailAttachment] = Field(default_factory=list, max_length=40)
open_url: str | None = Field(default=None, max_length=500, pattern=r"^https?://")
@@ -292,3 +304,8 @@ class TaskElementsIn(APIModel):
class TaskDependencyIn(APIModel):
depends_on_task_id: UUID
context: ContextIn | None = None
class ElementReferenceIn(APIModel):
refers_to_element_id: UUID
context: ContextIn | None = None
+44 -1
View File
@@ -19,6 +19,7 @@ from app.sources import (
delete_connector,
imap_mailboxes,
imap_messages,
imap_preview,
list_connectors,
paperless_content,
paperless_documents,
@@ -70,7 +71,7 @@ def view_paperless(
(element_id,),
).fetchone()
if ref is None or ref["source"] != "paperless":
raise unprocessable("Nur ein Paperless-Dokument lässt sich hier ansehen.")
raise unprocessable("Nur ein Paperless-Dokument lässt sich hier als Datei ansehen.")
data, media_type, filename = paperless_content(conn, principal.account_id, ref["external_id"])
safe_name = (filename or f"paperless-{ref['external_id']}.pdf").replace('"', "")
return Response(
@@ -84,6 +85,35 @@ def view_paperless(
)
@router.get("/api/v1/external-refs/{element_id}/mail")
def view_mail(
element_id: UUID,
context_kind: str | None = None,
context_id: str | None = None,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
element = get_element(conn, element_id)
if element is None or element["kind"] != "external_ref":
raise not_found()
rights = element_rights(conn, principal.account_id, element, parse_query_context(context_kind, context_id))
if not rights.read:
raise not_found()
ref = conn.execute(
"SELECT source, detail FROM external_references WHERE element_id = %s",
(element_id,),
).fetchone()
detail = (ref or {}).get("detail") or {}
if ref is None or ref["source"] != "imap":
raise unprocessable("Das ist keine E-Mail.")
connector_id = detail.get("connector_id")
mailbox = detail.get("mailbox") or ""
uid = detail.get("uid")
if not connector_id or not mailbox or not uid:
raise unprocessable("Für diese E-Mail ist keine Postfach-Vorschau hinterlegt.")
return imap_preview(conn, principal.account_id, UUID(str(connector_id)), str(mailbox), int(uid))
@router.get("/api/v1/sources/paperless/documents")
def search_paperless(q: str = "", principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
return {"items": paperless_documents(conn, principal.account_id, q.strip())}
@@ -112,6 +142,19 @@ def search_mail(
return imap_messages(conn, principal.account_id, connector_id, q.strip(), mailbox.strip(), before)
@router.get("/api/v1/sources/imap/message")
def read_mail(
connector_id: UUID,
mailbox: str,
uid: int,
principal: Principal = Depends(get_principal),
conn: Connection = Depends(get_conn),
):
if uid < 1:
raise unprocessable("Die Nachricht ist ungültig.")
return imap_preview(conn, principal.account_id, connector_id, mailbox.strip(), uid)
@router.post("/api/v1/sources/link", status_code=201)
def link_source(body: ExternalIn, principal: Principal = Depends(get_principal), conn: Connection = Depends(get_conn)):
if body.source not in {"paperless", "imap"}:
+5
View File
@@ -58,6 +58,11 @@ _PURGE = (
OR created_by IN (SELECT id FROM fixture_accounts)
""",
"""
DELETE FROM element_references
WHERE element_id IN (SELECT id FROM elements WHERE owner_subject_id IN (SELECT id FROM fixture_accounts))
OR refers_to_element_id IN (SELECT id FROM elements WHERE owner_subject_id IN (SELECT id FROM fixture_accounts))
""",
"""
DELETE FROM task_dependencies
WHERE task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts))
OR depends_on_task_id IN (SELECT id FROM tasks WHERE owner_subject_id IN (SELECT id FROM fixture_accounts))
+60 -2
View File
@@ -529,6 +529,8 @@ def create_note(
placement: Ctx | None,
chapter_id: UUID | None,
document_on: date | None = None,
sent_on: date | None = None,
received_on: date | None = None,
) -> dict:
document = clean_document(document)
target, rights_context = _placement(context, placement)
@@ -540,8 +542,8 @@ def create_note(
)
binding = insert_binding(conn, element["id"], target.kind, target.id, chapter_id, actor)
audit(conn, actor, scope_id, "note_created", "element", element["id"], rights_context or target)
if document_on is not None:
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, None, None)
if document_on is not None or sent_on is not None or received_on is not None:
record_dates(conn, actor, scope_id, element["id"], rights_context or target, document_on, sent_on, received_on)
return {"element": element, "binding": binding, "document": document}
@@ -962,6 +964,62 @@ def unlink_task_dependency(conn, actor: UUID, task_id: UUID, depends_on_task_id:
)
def _reference_chain(conn, start: UUID) -> set[UUID]:
seen: set[UUID] = set()
stack = [start]
while stack:
current = stack.pop()
if current in seen:
continue
seen.add(current)
rows = conn.execute(
"SELECT refers_to_element_id FROM element_references WHERE element_id = %s",
(current,),
).fetchall()
stack.extend(row["refers_to_element_id"] for row in rows)
return seen
def link_element_reference(conn, actor: UUID, element_id: UUID, refers_to_element_id: UUID, context: Ctx | None) -> None:
if element_id == refers_to_element_id:
raise unprocessable("Eine Unterlage kann nicht auf sich selbst Bezug nehmen.")
element = get_element(conn, element_id)
target = get_element(conn, refers_to_element_id)
if element is None or target is None:
raise not_found()
rights = element_rights(conn, actor, element, context)
target_rights = element_rights(conn, actor, target, context)
if not rights.read or not target_rights.read:
raise not_found()
if not rights.edit:
raise forbidden()
if element_id in _reference_chain(conn, refers_to_element_id):
raise unprocessable("Dieser Bezug würde einen Kreis bilden.")
conn.execute(
"""
INSERT INTO element_references (element_id, refers_to_element_id)
VALUES (%s, %s)
ON CONFLICT DO NOTHING
""",
(element_id, refers_to_element_id),
)
def unlink_element_reference(conn, actor: UUID, element_id: UUID, refers_to_element_id: UUID, context: Ctx | None) -> None:
element = get_element(conn, element_id)
if element is None:
raise not_found()
rights = element_rights(conn, actor, element, context)
if not rights.read:
raise not_found()
if not rights.edit:
raise forbidden()
conn.execute(
"DELETE FROM element_references WHERE element_id = %s AND refers_to_element_id = %s",
(element_id, refers_to_element_id),
)
def set_content_order(
conn,
actor: UUID,
+65 -1
View File
@@ -118,6 +118,8 @@ def _preview_meta(kind: str, content_type: str | None, source: str | None) -> di
return {"available": True, "media": "pdf", "source": "file"}
if kind == "external_ref" and source == "paperless":
return {"available": True, "media": "paperless", "source": "paperless"}
if kind == "external_ref" and source == "imap":
return {"available": True, "media": "email", "source": "imap"}
if kind == "file":
return {"available": False, "media": "file", "source": "file"}
return {"available": False, "media": "none", "source": source}
@@ -193,6 +195,66 @@ def _exception(conn, kind: str, resource_id: UUID, context: Ctx | None) -> dict
return {"remove_read": row["can_read"], "remove_edit": row["can_edit"], "remove_share": row["can_share"]}
def _reference_view(conn, actor: UUID, element_id: UUID, context: Ctx) -> dict | None:
element = get_element(conn, element_id)
if element is None or not element_rights(conn, actor, element, context).read:
return None
dates = _dates(conn, element)
direction = None
if element["kind"] == "external_ref":
ref = conn.execute(
"SELECT source, detail FROM external_references WHERE element_id = %s",
(element["id"],),
).fetchone()
detail = (ref["detail"] or {}) if ref is not None and ref["source"] == "imap" else {}
if detail.get("direction") in ("in", "out"):
direction = detail["direction"]
if direction is None:
if dates["sent_on"] and not dates["received_on"]:
direction = "out"
elif dates["received_on"] and not dates["sent_on"]:
direction = "in"
return {
"id": str(element["id"]),
"title": element["title"],
"document_on": dates["document_on"],
"direction": direction,
}
def _attach_references(conn, actor: UUID, element: dict, context: Ctx, body: dict) -> None:
refers = []
for row in conn.execute(
"""
SELECT refers_to_element_id
FROM element_references
WHERE element_id = %s
ORDER BY created_at, refers_to_element_id
""",
(element["id"],),
).fetchall():
view = _reference_view(conn, actor, row["refers_to_element_id"], context)
if view is not None:
refers.append(view)
replies = []
for row in conn.execute(
"""
SELECT element_id
FROM element_references
WHERE refers_to_element_id = %s
ORDER BY created_at, element_id
""",
(element["id"],),
).fetchall():
view = _reference_view(conn, actor, row["element_id"], context)
if view is not None:
replies.append(view)
if refers:
body["refers_to"] = refers
if replies:
body["referred_by"] = replies
def binding_payload(conn, actor: UUID, binding: dict, context: Ctx) -> dict | None:
element = get_element(conn, binding["element_id"])
if element is None:
@@ -200,13 +262,15 @@ def binding_payload(conn, actor: UUID, binding: dict, context: Ctx) -> dict | No
rights = element_rights(conn, actor, element, context)
if not rights.read:
return None
body = _element_body(conn, element)
_attach_references(conn, actor, element, context, body)
payload = {
"id": str(binding["id"]),
"position": binding["position"],
"chapter_id": str(binding["chapter_id"]) if binding["chapter_id"] else None,
"rights": rights.as_dict(),
"annotations": _annotations(conn, binding["id"]),
"element": _element_body(conn, element),
"element": body,
}
if element["owner_subject_id"] == actor:
payload["exception"] = _exception(conn, "element", element["id"], context)
+167 -1
View File
@@ -143,6 +143,21 @@ def imap_messages(
_imap_logout(client)
def imap_preview(conn, owner_id: UUID, connector_id: UUID, mailbox: str, uid: int) -> dict:
row = _owned(conn, owner_id, connector_id)
if row["kind"] != "imap":
raise unprocessable("Das ist kein E-Mail-Konto.")
_check_mailbox(mailbox)
if uid < 1:
raise unprocessable("Die Nachricht ist ungültig.")
client = _imap_login(row["settings"], row["secret"])
try:
_select_mailbox(client, mailbox)
return _fetch_message(client, uid, mailbox)
finally:
_imap_logout(client)
def _owned(conn, owner_id: UUID, connector_id: UUID) -> dict:
row = conn.execute(
"SELECT id, kind, name, settings, secret FROM connectors WHERE id = %s AND owner_id = %s",
@@ -432,13 +447,42 @@ def _uid_search(client: imaplib.IMAP4, query: str):
raise unprocessable("Das Postfach kann diese Suche nicht ausführen. Blättere im Fach oder kürze den Suchtext.") from exc
def _check_mailbox(mailbox: str) -> None:
if any(char in mailbox for char in "\r\n\x00"):
raise unprocessable("Der Fachname ist ungültig.")
def _select_mailbox(client: imaplib.IMAP4, mailbox: str) -> None:
folders = _imap_mailboxes(client)
match = next((item for item in folders if item["name"] == mailbox), None)
if match is None or not match["selectable"]:
raise unprocessable("Dieses Fach gibt es in dem Konto nicht.")
try:
status, _ = client.select(mailbox, readonly=True)
except imaplib.IMAP4.error as exc:
raise unprocessable("Dieses Fach lässt sich nicht öffnen.") from exc
if status != "OK":
raise unprocessable("Dieses Fach lässt sich nicht öffnen.")
def _fetch_header(client: imaplib.IMAP4, uid: int, mailbox: str) -> dict | None:
try:
status, fetched = client.uid("FETCH", str(uid), "(BODY.PEEK[HEADER.FIELDS (FROM SUBJECT DATE MESSAGE-ID)])")
status, fetched = client.uid(
"FETCH",
str(uid),
"(BODY.PEEK[HEADER.FIELDS (FROM TO CC SUBJECT DATE MESSAGE-ID)])",
)
except imaplib.IMAP4.error:
return None
if status != "OK" or not fetched or not isinstance(fetched[0], tuple):
return None
attachments = []
try:
struct_status, structure = client.uid("FETCH", str(uid), "(BODYSTRUCTURE)")
if struct_status == "OK":
attachments = _structure_attachments(structure)
except imaplib.IMAP4.error:
attachments = []
header = BytesParser().parsebytes(fetched[0][1])
subject = _decode(header.get("Subject")) or "(ohne Betreff)"
sender = _decode(header.get("From"))
@@ -448,10 +492,132 @@ def _fetch_header(client: imaplib.IMAP4, uid: int, mailbox: str) -> dict | None:
"uid": uid,
"title": subject[:200],
"message_from": sender[:200],
"message_to": _decode(header.get("To"))[:500],
"message_cc": _decode(header.get("Cc"))[:500],
"direction": _direction(mailbox),
"attachments": attachments,
"document_on": _mail_date(header.get("Date")),
}
def _fetch_message(client: imaplib.IMAP4, uid: int, mailbox: str) -> dict:
try:
status, fetched = client.uid("FETCH", str(uid), "(BODY.PEEK[])")
except imaplib.IMAP4.error as exc:
raise unprocessable("Die Nachricht lässt sich nicht lesen.") from exc
raw = _literal(fetched)
if status != "OK" or raw is None:
raise unprocessable("Die Nachricht lässt sich nicht lesen.")
if len(raw) > 1_500_000:
raise unprocessable("Die Nachricht ist zu groß für die Vorschau.")
message = BytesParser().parsebytes(raw)
subject = _decode(message.get("Subject")) or "(ohne Betreff)"
return {
"uid": uid,
"mailbox": mailbox,
"title": subject[:200],
"message_from": _decode(message.get("From"))[:200],
"message_to": _decode(message.get("To"))[:500],
"message_cc": _decode(message.get("Cc"))[:500],
"direction": _direction(mailbox),
"document_on": _mail_date(message.get("Date")),
"attachments": _message_attachments(message),
"text": _message_text(message),
}
_SENT_FOLDER = re.compile(
r"(^|/)(sent|sent items|sent messages|gesendet|gesendete|gesendete elemente|outbox|postausgang)($|/)",
re.IGNORECASE,
)
def _direction(mailbox: str) -> str:
folded = mailbox.casefold().replace("\\", "/")
return "out" if _SENT_FOLDER.search(folded) else "in"
def _literal(fetched) -> bytes | None:
for part in fetched or []:
if isinstance(part, tuple) and len(part) > 1 and isinstance(part[1], (bytes, bytearray)):
return bytes(part[1])
return None
def _structure_attachments(fetched) -> list[dict]:
chunks: list[bytes] = []
for part in fetched or []:
if isinstance(part, tuple):
chunks.extend(bytes(item) for item in part if isinstance(item, (bytes, bytearray)))
elif isinstance(part, (bytes, bytearray)):
chunks.append(bytes(part))
blob = b" ".join(chunks)
names = re.findall(br'FILENAME"\s+"([^"\r\n]+)"', blob, flags=re.IGNORECASE)
items = []
seen: set[str] = set()
for raw in names:
name = raw.decode("utf-8", errors="replace").strip()[:200]
if not name or name in seen:
continue
seen.add(name)
items.append({"filename": name})
if len(items) == 40:
break
return items
def _message_attachments(message) -> list[dict]:
items = []
seen: set[str] = set()
for part in message.walk():
filename = part.get_filename()
if not filename:
continue
name = _decode(filename)[:200]
if not name or name in seen:
continue
seen.add(name)
items.append({"filename": name, "content_type": part.get_content_type()[:120]})
if len(items) == 40:
break
return items
def _message_text(message) -> str:
plain: list[str] = []
html: list[str] = []
parts = message.walk() if message.is_multipart() else [message]
for part in parts:
if part.is_multipart() or part.get_content_disposition() == "attachment" or part.get_filename():
continue
kind = part.get_content_type()
if kind == "text/plain":
plain.append(_part_text(part))
elif kind == "text/html":
html.append(_html_text(_part_text(part)))
text = "\n".join(chunk for chunk in plain if chunk).strip()
if not text:
text = "\n".join(chunk for chunk in html if chunk).strip()
return text[:8000]
def _part_text(part) -> str:
payload = part.get_payload(decode=True)
if payload is None:
raw = part.get_payload()
return raw.strip() if isinstance(raw, str) else ""
charset = part.get_content_charset() or "utf-8"
return payload.decode(charset, errors="replace").strip()
def _html_text(value: str) -> str:
text = re.sub(r"(?is)<(script|style)\b.*?>.*?</\1>", " ", value)
text = re.sub(r"(?i)<br\s*/?>", "\n", text)
text = re.sub(r"(?i)</p>", "\n", text)
text = re.sub(r"<[^>]+>", " ", text)
return re.sub(r"[ \t]{2,}", " ", text).strip()
def _parse_list_line(raw) -> dict | None:
if not isinstance(raw, (bytes, str)) or not raw:
return None
@@ -0,0 +1,9 @@
CREATE TABLE element_references (
element_id uuid NOT NULL REFERENCES elements (id) ON DELETE CASCADE,
refers_to_element_id uuid NOT NULL REFERENCES elements (id) ON DELETE CASCADE,
created_at timestamptz NOT NULL DEFAULT now(),
PRIMARY KEY (element_id, refers_to_element_id),
CHECK (element_id <> refers_to_element_id)
);
CREATE INDEX element_references_target_idx ON element_references (refers_to_element_id);
+40
View File
@@ -35,8 +35,35 @@ class FakeIMAP:
return "OK", [b"2"]
return "OK", [b"1 2 3 4 5"]
uid = int(args[0])
spec = " ".join(str(part) for part in args[1:])
if "BODY.PEEK[]" in spec:
raw = (
f"From: Ada Beispiel <ada@example.test>\r\n"
f"To: Gegenseite <gegen@example.test>\r\n"
f"Subject: Nachricht {uid}\r\n"
f"Date: Thu, 02 May 2024 08:00:00 +0000\r\n"
f"Message-ID: <{uid}@example.test>\r\n"
f"MIME-Version: 1.0\r\n"
f'Content-Type: multipart/mixed; boundary="grenze"\r\n'
f"\r\n"
f"--grenze\r\n"
f"Content-Type: text/plain; charset=utf-8\r\n"
f"\r\n"
f"Bitte die Einwendung pruefen.\r\n"
f"--grenze\r\n"
f"Content-Type: application/pdf\r\n"
f"Content-Disposition: attachment; filename=\"einwendung.pdf\"\r\n"
f"\r\n"
f"%PDF\r\n"
f"--grenze--\r\n"
).encode()
return "OK", [(b"rfc822", raw)]
if "BODYSTRUCTURE" in spec:
structure = b'("ATTACHMENT" ("FILENAME" "einwendung.pdf"))'
return "OK", [structure]
header = (
f"From: Ada Beispiel <ada@example.test>\r\n"
f"To: Gegenseite <gegen@example.test>\r\n"
f"Subject: Nachricht {uid}\r\n"
f"Date: Thu, 02 May 2024 08:00:00 +0000\r\n"
f"Message-ID: <{uid}@example.test>\r\n"
@@ -96,6 +123,9 @@ def test_folder_pages_newest_first_and_search_stays_inside(client, db, monkeypat
assert [item["title"] for item in first["items"]] == ["Nachricht 5", "Nachricht 4"]
assert first["items"][0]["document_on"] == "2024-05-02"
assert first["items"][0]["message_from"] == "Ada Beispiel <ada@example.test>"
assert first["items"][0]["message_to"] == "Gegenseite <gegen@example.test>"
assert first["items"][0]["direction"] == "out"
assert first["items"][0]["attachments"] == [{"filename": "einwendung.pdf"}]
assert first["next_before"] == 4
older = ada.request(
"GET",
@@ -109,7 +139,17 @@ def test_folder_pages_newest_first_and_search_stays_inside(client, db, monkeypat
params={"connector_id": account, "mailbox": "INBOX", "q": "Einwendung"},
)
assert [item["title"] for item in found["items"]] == ["Nachricht 2"]
assert found["items"][0]["direction"] == "in"
assert found["next_before"] is None
preview = ada.request(
"GET",
"/api/v1/sources/imap/message",
params={"connector_id": account, "mailbox": "INBOX", "uid": 2},
)
assert preview["direction"] == "in"
assert preview["message_to"] == "Gegenseite <gegen@example.test>"
assert "Einwendung" in preview["text"]
assert preview["attachments"][0]["filename"] == "einwendung.pdf"
ada.request(
"GET",
"/api/v1/sources/imap/messages",
+93
View File
@@ -0,0 +1,93 @@
"""A reply refers to one earlier element; letters in between stay in the list."""
from __future__ import annotations
from tests.support import Actor, document, register
def _note(actor: Actor, title: str, matter_id: str, **dates) -> None:
actor.request(
"POST",
"/api/v1/notes",
json={
"title": title,
"document": document(title),
"context": {"kind": "matter", "id": matter_id},
"dates": dates,
},
status=201,
)
def _by_title(detail: dict) -> dict:
return {item["element"]["title"]: item["element"] for item in detail["bindings"]}
def test_reply_names_its_letter_and_leaves_the_gap(client, db):
ada = Actor(client, "ada-bezug@example.test", "Ada Bezug")
ben = Actor(client, "ben-bezug@example.test", "Ben Bezug")
register(db, ada.email, ada.name)
register(db, ben.email, ben.name)
ada.login()
matter = ada.request("POST", "/api/v1/matters", json={"title": "Schriftwechsel"}, status=201)
_note(ada, "Anschreiben", matter["id"], document_on="2026-03-12", received_on="2026-03-12")
_note(ada, "Zwischennachricht", matter["id"], document_on="2026-04-02", received_on="2026-04-02")
_note(ada, "Antwort", matter["id"], document_on="2026-05-18", sent_on="2026-05-18")
detail = ada.request("GET", f"/api/v1/matters/{matter['id']}")
ada.request(
"PATCH",
f"/api/v1/matters/{matter['id']}/content-order",
json={"expected_version": detail["version"], "mode": "date", "direction": "asc"},
)
elements = _by_title(ada.request("GET", f"/api/v1/matters/{matter['id']}"))
ada.request(
"POST",
f"/api/v1/elements/{elements['Antwort']['id']}/references",
json={"refers_to_element_id": elements["Antwort"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
status=422,
)
ada.request(
"POST",
f"/api/v1/elements/{elements['Antwort']['id']}/references",
json={"refers_to_element_id": elements["Anschreiben"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
status=204,
)
ada.request(
"POST",
f"/api/v1/elements/{elements['Anschreiben']['id']}/references",
json={"refers_to_element_id": elements["Antwort"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
status=422,
)
ben.login()
ben.request(
"POST",
f"/api/v1/elements/{elements['Antwort']['id']}/references",
json={"refers_to_element_id": elements["Zwischennachricht"]["id"], "context": {"kind": "matter", "id": matter["id"]}},
status=404,
)
ada.login()
shown = ada.request("GET", f"/api/v1/matters/{matter['id']}")
titles = [item["element"]["title"] for item in shown["bindings"]]
assert titles == ["Anschreiben", "Zwischennachricht", "Antwort"]
linked = _by_title(shown)
assert linked["Antwort"]["refers_to"] == [
{
"id": elements["Anschreiben"]["id"],
"title": "Anschreiben",
"document_on": "2026-03-12",
"direction": "in",
}
]
assert linked["Anschreiben"]["referred_by"][0]["title"] == "Antwort"
assert linked["Anschreiben"]["referred_by"][0]["direction"] == "out"
assert "refers_to" not in linked["Zwischennachricht"]
assert "referred_by" not in linked["Zwischennachricht"]
ada.request(
"DELETE",
f"/api/v1/elements/{elements['Antwort']['id']}/references/{elements['Anschreiben']['id']}",
params={"context_kind": "matter", "context_id": matter["id"]},
status=204,
)
cleared = _by_title(ada.request("GET", f"/api/v1/matters/{matter['id']}"))
assert "refers_to" not in cleared["Antwort"]
assert "referred_by" not in cleared["Anschreiben"]
+13 -1
View File
@@ -1,6 +1,6 @@
# Tsumugu – Fachliche Produktspezifikation
**Stand:** 17.10.2026 · **Arbeitsstand:** 0.28, Inhaltstyp-Symbole und verlässliche Ersatzdarstellung ergänzt.
**Stand:** 17.10.2026 · **Arbeitsstand:** 0.29, Notiz als Gesprächs- / Gedankenaufzeichnung visuell von Schriftstücken getrennt.
**Status:** Führende fachliche Arbeitsdatei; noch keine freigegebene Gesamtspezifikation.
**Aktuelle Ergänzung:** [Bedienung, Orientierung und Aktenordnung im MVP](TSUMUGU_UX_MVP_ERGAENZUNG.md). Sie sichert den Nutzerbedarf aus der Prüfung der inzwischen bestehenden Anwendung und konkrete Umsetzungsvorgaben für deren Überarbeitung. Bestätigter Bedarf und empfohlene Ausgestaltung sind dort getrennt; die historischen Etappenbeschreibungen dieser Datei bleiben als solche erhalten.
@@ -360,10 +360,18 @@ Der Nutzer nennt folgende tatsächlich genutzte Felder. Schreibweisen sind als G
### F-06c – Inhaltstypen ohne brauchbare Miniatur erkennen: 17.10.2026
**Bestätigte Präzisierung:** Eine einzelne Notiz bezeichnet üblicherweise eine Gesprächsnotiz, ein Gedankenprotokoll oder eine eigene Aufzeichnung. Ihr Symbol muss sich deutlich vom Dokument-/PDF-Symbol unterscheiden. Das korrigierte Motiv ist eine runde Sprechblase mit Stift; kein weiterer Papierumriss. Das ändert weder das bestehende Notizmodell noch beauftragt es eine Chatfunktion.
**Aktueller Nutzerbedarf:** Für die unterschiedlichen Inhaltselemente werden einzelne Symboldateien benötigt. Vorschauen können häufig nicht erzeugt werden; kleine Dokumentbilder erklären den Inhalt wegen unlesbarer Schrift oft nur unzureichend. Zusätzlich wird die Logo-Einbindung auf dunkelgrünem App-Hintergrund mit einem geeigneten Rahmen und runden Ecken verlangt.
**Konkrete Ausgestaltung dieser Lieferung:** Eindeutiges Typ-Symbol als verlässliche Orientierung, Titel/Datum/Beschreibung bleiben zentral. Aussagekräftige Bildminiaturen können ergänzen; kleine PDF-Seitenbilder sind keine Voraussetzung für eine brauchbare Liste. Notizen erhalten Symbol und lesbaren Auszug. Fehlende Miniaturen werden nicht als große leere Textbox oder endloser Ladezustand dargestellt. Große Dokumentvorschau und Originalöffnung bleiben erhalten. Format und Quelle werden getrennt benannt; Paperless ist keine Formatgarantie. Fertige Symbol-/Rahmendateien und Einbindungsregeln stehen in [TSUMUGU_SYMBOLS_LOGOFRAME_AUFTRAG.md](TSUMUGU_SYMBOLS_LOGOFRAME_AUFTRAG.md). Die Präzisierung ersetzt die pauschale Thumbnail-Pflicht aus der älteren UX-Ergänzung; das ausgewählte Zeilenlayout und alle fachlichen/rechtlichen Regeln bleiben erhalten.
### F-06d – Bezug zwischen Unterlagen und Herkunft der Vorschau: 17.10.2026
**Nutzerauftrag:** Eine Unterlage kann die Antwort auf eine konkrete andere sein. Dazwischen können weitere Schreiben eingegangen oder hinausgegangen sein. Diese Beziehung soll gespeichert und sichtbar sein, ohne die zeitliche Liste zusammenzuziehen. Eingehend und ausgehend müssen unterscheidbar sein. E-Mails werden vor dem Übernehmen gelesen; Absender, Empfänger und Anhänge bleiben danach erkennbar. Die Vorschau folgt Typ und Herkunft.
**Ausgestaltung:** Der Bezug verbindet zwei Elemente. Er ist kein zweites Elternteil und kein Vorgangsquerverweis. Die Inhaltsliste bleibt in ihrer gewählten Ordnung; die Zwischenstücke bleiben eigene Zeilen. An beiden Enden steht der Bezug mit Datum und Titel. Im Leser zeigt der Schriftwechsel nur die verbundenen Unterlagen und ihre Daten. Ein Kreis und ein Selbstbezug sind unzulässig. Ein nicht lesbares Gegenstück wird nicht benannt. E-Mail-Eingang und -Ausgang folgen dem Postfach. Andere Unterlagen zeigen Eingang oder Ausgang, wenn Zugangs- oder Versanddatum gesetzt ist. Die E-Mail-Vorschau lädt den Nachrichtentext; Paperless bleibt der Dateiweg.
## 6. Fortschreibung
16.10.2026, Arbeitsstand 0.1: Recovery vollständig gelesen, Repository-Unterlagen gezielt abgeglichen, ursprüngliche Nutzernachrichten geprüft und Ergänzungen gesichert. Historische Baseline unverändert übernommen.
@@ -422,4 +430,8 @@ Der Nutzer nennt folgende tatsächlich genutzte Felder. Schreibweisen sind als G
17.10.2026, Arbeitsstand 0.28: Aktuellen Nutzerbedarf F-06c zu getrennten Inhaltstyp-Symbolen und unbrauchbaren Miniaturen gesichert. UX-Ergänzung 0.3 präzisiert die Bedeutung echter Vorschauen gegenüber Typ-Symbol, lesbarem Auszug und großem Leser. Der zugehörige Asset-/Cursor-Auftrag ergänzt außerdem einen gerundeten Logo-Rahmen für dunkle Flächen. Keine Änderung an Fachmodell oder Anwendungscode durch diese Fortschreibung.
17.10.2026, Arbeitsstand 0.29: Nutzerpräzisierung zu F-06c: Notiz steht für Gesprächs-/Gedankenaufzeichnung und muss eine andere Silhouette als ein Schriftstück haben. Symbolpaket 1.1 liefert dafür eine runde Sprechblase mit Stift. Cursor-Auftrag und einzelne SVG-/PNG-Dateien aktualisiert; keine neue Chatfunktion oder Änderung am Notizmodell.
17.10.2026, Arbeitsstand 0.30: Nutzerauftrag F-06d aufgenommen. Ein Element kann sich auf ein anderes beziehen; die chronologische Lücke bleibt in der Liste. E-Mail-Vorschau, Richtung und Anhänge werden nach Typ und Herkunft geladen. Kein neues Elternverhältnis und keine Änderung an Aktenrechten.
Nach jeder Entscheidung diese Datei mit kurzer Begründung und Auswirkungen auf Fachmodell/MVP aktualisieren. Die historische Baseline bleibt unverändert. Keine Implementierung ohne ausdrückliche Freigabe; technische Umsetzung später anhand der dann freigegebenen Jinkendo-Blueprints.
@@ -14,6 +14,7 @@ Die angemeldete Development-Ansicht wurde am 17.10.2026 lesend angesehen. Im dun
## A. Typ-Symbol als zuverlässige Orientierung
- **Präzisierung 17.10.2026, Symbolpaket 1.1:** Eine einzelne Notiz ist typischerweise eine Gesprächsnotiz, ein Gedankenprotokoll oder eine eigene Aufzeichnung. Dafür das überarbeitete `note.svg` verwenden: **runde Sprechblase mit Stift**, deutlich andere Silhouette als PDF/Schriftstück. Die alte Haftnotiz nicht weiterverwenden. Bereits übernommene Notiz-SVGs und PNGs in beiden Farbvarianten ersetzen und die Auslieferung der neuen Dateien prüfen. Die Sprechblase steht für die aufgezeichnete Notiz, nicht für eine neu zu bauende Chatfunktion. Paperless bleibt eine Quellenangabe; bekannte PDF-Dateien erhalten das PDF-Symbol.
- Führendes Inhaltstyp-Symbol in jeder Eintragszeile, auch ohne abrufbare Vorschau. PDF, Textdokument, Notiz, Bild usw. über die gelieferten Motive unterscheiden. Titel, fachliches Datum, Beschreibung und lesbare Typ-/Quellenangabe bleiben erhalten.
- PDF-/Textseiten und Notizen brauchen standardmäßig keine unlesbare kleine Seitenansicht. Bei Fotos oder anderen wirklich aussagekräftigen Motiven kann eine zusätzliche Miniatur sinnvoll bleiben; der Inhaltstyp bleibt erkennbar. Keine neue umfangreiche Ansichtsverwaltung bauen.
- Fehlt eine Miniatur, direkt das Typ-Symbol zeigen. Keine große leere Box mit mehrzeiligem „Keine Vorschau“ oder einem dauerhaften Ladetext. Eine nicht verfügbare Miniatur ist nicht automatisch ein defektes Dokument oder fehlendes Leserecht.
+14 -2
View File
@@ -1,6 +1,6 @@
# Tsumugu – Ergänzung zur Bedienung, Orientierung und Aktenordnung im MVP
**Stand:** 17.10.2026 · **Fassung:** 0.3, Inhaltstyp-Symbole und nutzbare Vorschau konkretisiert
**Stand:** 17.10.2026 · **Fassung:** 0.4, Bezug zwischen Unterlagen und herkunftsabhängige Vorschau konkretisiert
**Zweck:** Referenz für die Überarbeitung der bestehenden MVP-Anwendung durch den Coding-Agenten.
**Bezug:** [Fachliche Produktspezifikation](TSUMUGU_PRODUCT_SPEC.md), insbesondere S-01a–d, F-04a und F-05a; [technischer Entwurf](../architecture/TSUMUGU_TECHNICAL_SPEC.md).
@@ -165,7 +165,17 @@ Die Inhaltsliste zeigt je Eintrag mindestens Titel, Typ und das vorhandene fachl
Weitere frei kombinierbare Sortierregeln oder ein allgemeiner Regelbaukasten sind kein MVP-Ziel. Eine zusätzliche einfache Titelsortierung ist optional und darf die beiden erforderlichen Modi nicht verzögern.
### 7.3 Speicherung und Interaktion
### 7.3 Bezug auf eine konkrete Unterlage
Ein Schreiben kann die Antwort auf ein bestimmtes früheres Schreiben sein. Der Bezug speichert genau diese Beziehung. Er sortiert die Liste nicht um und zieht die beiden Enden nicht zusammen. Schreiben, die dazwischen eingegangen oder hinausgegangen sind, bleiben eigene Zeilen an ihrer fachlichen Stelle.
- An der Antwort steht „Bezug auf“ mit Datum und Titel der früheren Unterlage. An jener steht „Darauf bezogen“ mit den Antworten.
- Der Leser zeigt denselben Schriftwechsel als eigene Folge, nur aus den verbundenen Unterlagen. Die Lücke bleibt in der Inhaltsliste sichtbar.
- Ein Klick auf den Bezug öffnet die andere Unterlage, ohne die gewählte Liste oder ihre Position zu wechseln.
- Der Bezug ist kein Kapitel, kein zweites Elternteil und kein Querverweis zwischen Vorgängen.
- Eingang und Ausgang sind an E-Mails aus dem Postfach erkennbar, an anderen Unterlagen aus Versand- oder Zugangsdatum. Absender, Empfänger und Anhänge bleiben an der übernommenen E-Mail sichtbar.
### 7.4 Speicherung und Interaktion
- Eigene Positionen gehören zur Einbindung im jeweiligen Container, nicht zum globalen Dokument. Dieselbe Unterlage kann in Akte A zuerst und in Vorgang B zuletzt stehen.
- Eine Inhaltsordnung innerhalb desselben Vorgangs bleibt dessen Ordnung, auch wenn der Vorgang über unterschiedliche Akten geöffnet wird. Die Position des Vorgangs innerhalb einer Akte gehört dagegen zu seiner dortigen Zuordnung.
@@ -219,6 +229,8 @@ Ein Klick auf eine Unterlage führt unmittelbar zu einer brauchbaren Lese-/Detai
Für neue Inhalte genügen klar benannte Einstiege für Notiz, Datei und externe Referenz. Bereits vorhandene E-Mail- oder Paperless-Funktionen bleiben nutzbar; keine neue Importplattform bauen. Kurze Formulare mit Titel, Inhalt/Quelle und optionalem fachlichem Datum; weitere Optionen bei Bedarf. Gewählter Zielkontext und gegebenenfalls Kapitel müssen erkennbar sein. Nach dem Speichern erscheint der Eintrag im Ziel und an der erklärbaren Position.
Eine E-Mail wird vor dem Übernehmen in einer Vorschau gelesen. Der Klick wählt sie aus; übernommen wird sie erst ausdrücklich. Ordner und Nachrichtenliste bleiben kompakt, linksbündig und unabhängig scrollbar. Richtung, Absender, Empfänger und Anhänge sind in der Liste und nach dem Einfügen sichtbar. Der Leser lädt den Nachrichtentext aus dem Postfach. Paperless-Dateien bleiben ein eigener Vorschauweg. Andere Herkunft erhält nicht die E-Mail-Ansicht.
„Aufgabe hinzufügen“ und „Frist erfassen“ erhalten eindeutige Einstiege. Ein gemeinsamer Dialog mit einer verständlichen Auswahl ist zulässig; zwei gleichzeitig offene, konkurrierende Formulare vermeiden. Arbeitstermin einer Aufgabe und maßgebliche Frist klar beschriften. Aufgabe erledigen und Frist als erfüllt kennzeichnen bleiben getrennte Aktionen. Lange allgemeine Erklärungen durch kurze kontextuelle Hilfen ersetzen.
Formulare zeigen Fehler am betroffenen Feld, sichern Eingaben bei fehlgeschlagenem Speichern und verhindern unbeabsichtigte Mehrfachanlage. Bei tatsächlich ungesicherten Eingaben vor dem Verlassen warnen; leere Dialoge ohne unnötige Rückfrage schließen lassen.
+17 -1
View File
@@ -469,6 +469,10 @@ export function CaseDetail() {
onReload={load}
canDetach={canEdit}
canDestroy={Boolean(record.is_owner)}
onOpenRelated={(elementId) => {
const found = (record.bindings || []).find((item) => item.element?.id === elementId);
if (found) openEntry(found);
}}
/>
) : null}
>
@@ -815,6 +819,8 @@ export function NoteForm({ context, placement, chapters = [], initialChapter = "
const [title, setTitle] = useState("");
const [text, setText] = useState("");
const [documentOn, setDocumentOn] = useState("");
const [sentOn, setSentOn] = useState("");
const [receivedOn, setReceivedOn] = useState("");
const [chapterId, setChapterId] = useState(initialChapter);
const [error, setError] = useState("");
const [pending, setPending] = useState(false);
@@ -835,12 +841,20 @@ export function NoteForm({ context, placement, chapters = [], initialChapter = "
context,
...(placement ? { placement } : {}),
...(chapterId ? { chapter_id: chapterId } : {}),
...(documentOn ? { dates: { document_on: documentOn } } : {}),
...(documentOn || sentOn || receivedOn ? {
dates: {
document_on: documentOn || null,
sent_on: sentOn || null,
received_on: receivedOn || null,
},
} : {}),
},
});
setTitle("");
setText("");
setDocumentOn("");
setSentOn("");
setReceivedOn("");
markDirty(false);
onChange();
} catch (err) {
@@ -857,6 +871,8 @@ export function NoteForm({ context, placement, chapters = [], initialChapter = "
<label>Titel <input value={title} onChange={(event) => { setTitle(event.target.value); markDirty(true); }} required /></label>
<label>Gemeinsamer Text <textarea rows={4} value={text} onChange={(event) => { setText(event.target.value); markDirty(true); }} /></label>
<label>Bezugsdatum, optional <input type="date" value={documentOn} onChange={(event) => setDocumentOn(event.target.value)} /></label>
<label>Versand, optional <input type="date" value={sentOn} onChange={(event) => setSentOn(event.target.value)} /></label>
<label>Zugang, optional <input type="date" value={receivedOn} onChange={(event) => setReceivedOn(event.target.value)} /></label>
{chapterSelect(chapters, chapterId, setChapterId)}
<button type="submit" disabled={pending}>{pending ? "Wird angelegt …" : "Notiz anlegen"}</button>
<ErrorNote error={error} />
+4
View File
@@ -408,6 +408,10 @@ export function MatterDetail() {
onReload={load}
canDetach={canEdit}
canDestroy={Boolean(record.is_owner)}
onOpenRelated={(elementId) => {
const found = (record.bindings || []).find((item) => item.element?.id === elementId);
if (found) openEntry(found);
}}
/>
) : null}
>
+110 -15
View File
@@ -1,13 +1,62 @@
import { useEffect, useRef, useState } from "react";
import { documentToText, fetchFile, fetchPaperless, markDirty, textToDocument, api } from "../api.js";
import { ErrorNote } from "./widgets.jsx";
import { formatDate, kindLabel } from "./content.jsx";
import { elementFacts, formatDate } from "./content.jsx";
import { NavIcon } from "./icons.jsx";
import workerSrc from "pdfjs-dist/build/pdf.worker.min.mjs?url";
const SCALES = [0.75, 1, 1.25, 1.5, 2];
export function ReadingPane({ binding, context, backLabel, onClose, onReload, canDetach, canDestroy }) {
function MailAttachments({ files }) {
if (!files?.length) return <p className="muted">Keine Anhänge.</p>;
return (
<ul className="mail-files">
{files.map((file) => <li key={file.filename}>{file.filename}</li>)}
</ul>
);
}
function Correspondence({ element, onOpenRelated }) {
const refers = element.refers_to || [];
const replies = element.referred_by || [];
if (!refers.length && !replies.length) return null;
const current = {
id: element.id,
title: element.title,
document_on: element.dates?.document_on || null,
direction: element.external?.detail?.direction || (element.dates?.sent_on && !element.dates?.received_on ? "out" : element.dates?.received_on && !element.dates?.sent_on ? "in" : null),
current: true,
};
const seen = new Set();
const items = [];
for (const item of [...refers, current, ...replies]) {
if (seen.has(item.id)) continue;
seen.add(item.id);
items.push({ ...item, current: item.id === element.id });
}
items.sort((left, right) => String(left.document_on || "9999-99-99").localeCompare(String(right.document_on || "9999-99-99")));
return (
<section className="schriftwechsel" aria-label="Schriftwechsel">
<h3>Schriftwechsel</h3>
<p>Verbundene Schreiben bleiben als Bezug sichtbar. Weitere Schreiben, die dazwischen ein- oder ausgegangen sind, bleiben in der Liste an ihrer eigenen Stelle.</p>
{items.map((item) => (
<button
key={item.id}
type="button"
className={item.current ? "schriftwechsel__item is-current" : "schriftwechsel__item"}
disabled={item.current || !onOpenRelated}
onClick={() => onOpenRelated?.(item.id)}
>
<span>{formatDate(item.document_on)}</span>
<strong>{item.current ? `${item.title} · diese Unterlage` : item.title}</strong>
<em>{item.direction === "out" ? "Ausgang" : item.direction === "in" ? "Eingang" : ""}</em>
</button>
))}
</section>
);
}
export function ReadingPane({ binding, context, backLabel, onClose, onReload, canDetach, canDestroy, onOpenRelated }) {
const element = binding?.element;
const [error, setError] = useState("");
const [phase, setPhase] = useState("idle");
@@ -21,8 +70,11 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
const [note, setNote] = useState("");
const [summary, setSummary] = useState("");
const [documentOn, setDocumentOn] = useState("");
const [sentOn, setSentOn] = useState("");
const [receivedOn, setReceivedOn] = useState("");
const [notice, setNotice] = useState("");
const [annotate, setAnnotate] = useState(false);
const [letter, setLetter] = useState(null);
const canvasRef = useRef(null);
const closeRef = useRef(null);
@@ -34,6 +86,8 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
if (!element) return undefined;
setText(element.kind === "note" ? documentToText(element.document) : "");
setDocumentOn(element.dates?.document_on || "");
setSentOn(element.dates?.sent_on || "");
setReceivedOn(element.dates?.received_on || "");
setSummary(element.summary || "");
setError("");
setNotice("");
@@ -41,16 +95,18 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
setPdf(null);
setPages(0);
setMedia("");
setPhase(element.kind === "note" ? "ready" : element.preview?.available ? "loading" : "missing");
setLetter(null);
const mail = element.external?.source === "imap";
setPhase(element.kind === "note" || mail ? "ready" : element.preview?.available ? "loading" : "missing");
return undefined;
}, [element?.id, element?.version]);
useEffect(() => {
if (!element || element.kind === "note" || !element.preview?.available) return undefined;
if (!element || element.kind === "note" || element.external?.source === "imap" || !element.preview?.available) return undefined;
let alive = true;
let url = "";
setPhase("loading");
const load = element.kind === "external_ref" ? fetchPaperless(element.id, context) : fetchFile(element.id, context);
const load = element.external?.source === "paperless" ? fetchPaperless(element.id, context) : fetchFile(element.id, context);
load.then(async (blob) => {
if (!alive) return;
url = URL.createObjectURL(blob);
@@ -93,7 +149,27 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
alive = false;
if (url) URL.revokeObjectURL(url);
};
}, [element?.id, element?.preview?.available, context?.kind, context?.id]);
}, [element?.id, element?.kind, element?.external?.source, element?.preview?.available, context?.kind, context?.id]);
useEffect(() => {
if (!element || element.external?.source !== "imap") return undefined;
let alive = true;
const params = new URLSearchParams();
if (context?.kind && context?.id) {
params.set("context_kind", context.kind);
params.set("context_id", context.id);
}
api(`/api/v1/external-refs/${element.id}/mail?${params}`)
.then((data) => {
if (alive) setLetter(data);
})
.catch(() => {
if (alive) setLetter(null);
});
return () => {
alive = false;
};
}, [element?.id, element?.external?.source, context?.kind, context?.id]);
useEffect(() => () => {
pdf?.destroy?.();
@@ -143,7 +219,7 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
async function openOriginal() {
setError("");
try {
const blob = element.kind === "external_ref"
const blob = element.external?.source === "paperless"
? await fetchPaperless(element.id, context)
: await fetchFile(element.id, context);
const url = URL.createObjectURL(blob);
@@ -194,8 +270,8 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
body: {
expected_version: element.version,
document_on: documentOn || null,
sent_on: element.dates?.sent_on || null,
received_on: element.dates?.received_on || null,
sent_on: sentOn || null,
received_on: receivedOn || null,
context,
},
});
@@ -249,11 +325,9 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
);
}
const typeLabel = element.kind === "file" && element.file?.content_type === "application/pdf"
? "PDF"
: element.kind === "external_ref"
? (element.external?.source === "imap" ? "E-Mail" : kindLabel(element.kind))
: kindLabel(element.kind);
const typeLabel = elementFacts(element);
const isMail = element.external?.source === "imap";
const mailDetail = letter || element.external?.detail || {};
return (
<section className="reader-pane" aria-label="Leser">
@@ -266,7 +340,7 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
<p>{formatDate(element.dates?.document_on)} · {typeLabel}</p>
</div>
<div className="reader-pane__tools">
{element.kind !== "note" ? (
{element.kind !== "note" && !isMail ? (
<button type="button" className="icon-button" aria-label="Original öffnen" onClick={openOriginal}>
<NavIcon name="link" />
</button>
@@ -278,6 +352,19 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
</header>
<div className="reader-pane__stage">
<ErrorNote error={error} />
<Correspondence element={element} onOpenRelated={onOpenRelated} />
{isMail ? (
<article className="mail-letter">
<p>{mailDetail.direction === "out" ? "Ausgang" : "Eingang"}</p>
<p><span>Von</span> {mailDetail.message_from || "Ohne Absender"}</p>
<p><span>An</span> {mailDetail.message_to || "Ohne Empfänger"}</p>
{mailDetail.message_cc ? <p><span>Kopie</span> {mailDetail.message_cc}</p> : null}
<MailAttachments files={mailDetail.attachments} />
{letter?.text ? <pre className="mail-letter__body">{letter.text}</pre> : (
<p className="muted">Der Text wird aus dem Postfach geladen, sobald das Konto erreichbar ist. Absender und Empfänger bleiben an der E-Mail gespeichert.</p>
)}
</article>
) : null}
{element.kind === "note" ? (
<form className="reader-note" onSubmit={saveNote}>
<label>
@@ -368,6 +455,14 @@ export function ReadingPane({ binding, context, backLabel, onClose, onReload, ca
{element.kind === "note" ? "Bezugsdatum, optional" : "Dokumentdatum, optional"}
<input type="date" value={documentOn} onChange={(event) => { setDocumentOn(event.target.value); markDirty(true); }} />
</label>
<label>
Versand, optional
<input type="date" value={sentOn} onChange={(event) => { setSentOn(event.target.value); markDirty(true); }} />
</label>
<label>
Zugang, optional
<input type="date" value={receivedOn} onChange={(event) => { setReceivedOn(event.target.value); markDirty(true); }} />
</label>
<button type="submit" className="quiet">Datum speichern</button>
</form>
) : null}
+101 -10
View File
@@ -251,6 +251,15 @@ function FolderBranch({ node, mailbox, expanded, onToggle, onSelect }) {
);
}
function MailFiles({ files }) {
if (!files?.length) return <p className="muted">Keine Anhänge.</p>;
return (
<ul className="mail-files">
{files.map((file) => <li key={file.filename}>{file.filename}</li>)}
</ul>
);
}
function FolderTree({ folders, mailbox, onSelect }) {
const [expanded, setExpanded] = useState(() => new Set());
useEffect(() => {
@@ -290,6 +299,9 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
const [query, setQuery] = useState("");
const [items, setItems] = useState([]);
const [nextBefore, setNextBefore] = useState(null);
const [selectedKey, setSelectedKey] = useState("");
const [preview, setPreview] = useState(null);
const [previewError, setPreviewError] = useState("");
const [loading, setLoading] = useState("");
const [error, setError] = useState("");
@@ -338,6 +350,9 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
setDraft("");
setItems([]);
setNextBefore(null);
setSelectedKey("");
setPreview(null);
setPreviewError("");
setError("");
setLoading("Nachrichten werden gelesen …");
const params = new URLSearchParams({ connector_id: accountId, mailbox });
@@ -370,6 +385,9 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
setQuery(draft.trim());
setItems(data.items || []);
setNextBefore(data.next_before ?? null);
setSelectedKey("");
setPreview(null);
setPreviewError("");
} catch (err) {
setError(err.message);
} finally {
@@ -394,8 +412,46 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
}
}
function choose(item) {
const key = `${mailbox}:${item.uid || item.id}`;
setSelectedKey(key);
setPreview(null);
setPreviewError("");
if (!item.uid) {
setPreviewError("Diese Nachricht lässt sich nicht öffnen.");
return;
}
const params = new URLSearchParams({ connector_id: accountId, mailbox, uid: String(item.uid) });
api(`/api/v1/sources/imap/message?${params}`)
.then((data) => {
setPreview(data);
})
.catch((err) => setPreviewError(err.message));
}
async function link(item) {
setError("");
const letter = preview && preview.uid === item.uid ? preview : null;
const direction = (letter?.direction || item.direction) === "out" ? "out" : "in";
const attachments = (letter?.attachments || item.attachments || [])
.filter((file) => file?.filename)
.map((file) => ({
filename: file.filename,
...(file.content_type ? { content_type: file.content_type } : {}),
}));
const detail = {
direction,
mailbox,
connector_id: accountId,
uid: item.uid,
};
const from = letter?.message_from || item.message_from;
const to = letter?.message_to || item.message_to;
const cc = letter?.message_cc || item.message_cc;
if (from) detail.message_from = from;
if (to) detail.message_to = to;
if (cc) detail.message_cc = cc;
if (attachments.length) detail.attachments = attachments;
try {
await api("/api/v1/external-refs", {
method: "POST",
@@ -406,8 +462,14 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
context,
...(placement ? { placement } : {}),
...(chapterId ? { chapter_id: chapterId } : {}),
...(item.document_on ? { dates: { document_on: item.document_on, sent_on: null, received_on: null } } : {}),
...(item.message_from ? { detail: { message_from: item.message_from } } : {}),
...(item.document_on ? {
dates: {
document_on: item.document_on,
sent_on: direction === "out" ? item.document_on : null,
received_on: direction === "in" ? item.document_on : null,
},
} : {}),
detail,
},
});
onDone();
@@ -416,6 +478,8 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
}
}
const selected = items.find((item) => `${mailbox}:${item.uid || item.id}` === selectedKey) || null;
return (
<div className="stack">
<TargetLine label={targetLabel} chapterId={chapterId} chapterTitle={chapterTitle} />
@@ -429,7 +493,7 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
</select>
</label>
{!accounts.length ? <p className="muted">Lege zuerst ein E-Mail-Konto unter <Link to="/sources">Quellen</Link> an.</p> : null}
<div className="mailbox">
<div className="mailbox mailbox--read">
<FolderTree folders={folders} mailbox={mailbox} onSelect={setMailbox} />
<div className="mailbox__messages">
<form onSubmit={search} className="inline">
@@ -443,16 +507,43 @@ export function MailPicker({ context, placement, chapterId = "", chapterTitle =
<p className="muted">{query ? "In diesem Fach gibt es dazu keine Nachricht." : "In diesem Fach gibt es keine Nachricht."}</p>
) : null}
<div className="mail-list">
{items.map((item) => (
<button key={`${mailbox}:${item.uid || item.id}`} type="button" className="mail-row" onClick={() => link(item)}>
<span>{formatDate(item.document_on)}</span>
<strong>{item.title}</strong>
<span>{item.message_from || "Ohne Absender"}</span>
</button>
))}
{items.map((item) => {
const key = `${mailbox}:${item.uid || item.id}`;
const outgoing = item.direction === "out";
const who = outgoing ? (item.message_to ? `an ${item.message_to}` : "Ausgang") : (item.message_from || "Ohne Absender");
const files = item.attachments?.length || 0;
return (
<button key={key} type="button" className={key === selectedKey ? "mail-row is-current" : "mail-row"} aria-current={key === selectedKey ? "true" : undefined} onClick={() => choose(item)}>
<span className="mail-row__date">{formatDate(item.document_on)}</span>
<span className="mail-row__main">
<strong>{item.title}</strong>
<span>{outgoing ? "Ausgang" : "Eingang"} · {who}</span>
</span>
{files ? <span className="mail-row__files" aria-label={`${files} ${files === 1 ? "Anhang" : "Anhänge"}`}>{files}</span> : null}
</button>
);
})}
</div>
{nextBefore ? <button type="button" className="quiet" onClick={older} disabled={!!loading}>Ältere laden</button> : null}
</div>
<aside className="mail-preview" aria-label="E-Mail-Vorschau">
{!selected ? <p className="muted">Wähle eine Nachricht, um Absender, Empfänger und Inhalt zu prüfen.</p> : (
<>
<h3>{preview?.title || selected.title}</h3>
<p className="mail-preview__party">{(preview?.direction || selected.direction) === "out" ? "Ausgang" : "Eingang"}</p>
<p><span>Von</span> {preview?.message_from || selected.message_from || "Ohne Absender"}</p>
<p><span>An</span> {preview?.message_to || selected.message_to || "Ohne Empfänger"}</p>
{(preview?.message_cc || selected.message_cc) ? <p><span>Kopie</span> {preview?.message_cc || selected.message_cc}</p> : null}
<p><span>Datum</span> {formatDate(preview?.document_on || selected.document_on)}</p>
<MailFiles files={preview?.attachments || selected.attachments || []} />
{previewError ? <p className="error">{previewError}</p> : null}
{selected && !preview && !previewError ? <p className="muted">Vorschau wird geladen …</p> : null}
{preview?.text ? <pre className="mail-letter__body">{preview.text}</pre> : null}
{preview && !preview.text ? <p className="muted">Diese Nachricht hat keinen lesbaren Text.</p> : null}
<button type="button" onClick={() => link(selected)} disabled={!selected.uid}>Übernehmen</button>
</>
)}
</aside>
</div>
</div>
);
+132 -2
View File
@@ -250,10 +250,81 @@ function sourceLabel(element) {
return type;
}
export function mailFacts(element) {
if (element?.external?.source !== "imap") return "";
const detail = element.external.detail || {};
const way = detail.direction === "out" ? "Ausgang" : "Eingang";
const from = detail.message_from ? `von ${detail.message_from}` : "";
const to = detail.message_to ? `an ${detail.message_to}` : "";
const count = Array.isArray(detail.attachments) ? detail.attachments.length : 0;
const files = count ? `${count} ${count === 1 ? "Anhang" : "Anhänge"}` : "";
return [way, from, to, files].filter(Boolean).join(" · ");
}
function dateFlow(element) {
if (element?.external?.source === "imap") return "";
const dates = element?.dates || {};
if (dates.sent_on && dates.received_on) return "Eingang · Ausgang";
if (dates.sent_on) return "Ausgang";
if (dates.received_on) return "Eingang";
return "";
}
export function elementFacts(element) {
const type = sourceLabel(element);
const mail = mailFacts(element);
const flow = dateFlow(element);
return [type, mail, flow].filter(Boolean).join(" · ");
}
function directionMark(direction) {
if (direction === "out") return "Ausgang";
if (direction === "in") return "Eingang";
return "";
}
function blurb(element) {
return element.summary || element.excerpt || "";
}
function BezugLines({ element, source, onOpen, itemHref }) {
const refers = element.refers_to || [];
const replies = element.referred_by || [];
if (!refers.length && !replies.length) return null;
return (
<div className="bezug">
{refers.map((item) => (
<BezugLink key={`to-${item.id}`} item={item} label="Bezug auf" source={source} onOpen={onOpen} itemHref={itemHref} />
))}
{replies.map((item) => (
<BezugLink key={`by-${item.id}`} item={item} label="Darauf bezogen" source={source} onOpen={onOpen} itemHref={itemHref} reply />
))}
</div>
);
}
function BezugLink({ item, label, source, onOpen, itemHref, reply = false }) {
const found = source.find((entry) => entry.element?.id === item.id);
const href = found && itemHref ? itemHref(found) : "";
const className = reply ? "bezug__link bezug__link--reply" : "bezug__link";
const body = (
<>
<span>{label}</span>
<strong>{formatDate(item.document_on)} · {item.title}</strong>
{directionMark(item.direction) ? <em>{directionMark(item.direction)}</em> : null}
</>
);
if (found && onOpen) {
return (
<button type="button" className={className} onClick={() => onOpen(found)}>
{body}
</button>
);
}
if (href) return <Link className={className} to={href}>{body}</Link>;
return <p className={className}>{body}</p>;
}
function TypeGlyph({ name, tone, size = 28 }) {
return (
<img
@@ -355,6 +426,42 @@ export function ContentBoard({
const canDestroy = Boolean(record?.is_owner);
const canMoveChapters = Boolean(canSort && chapters.length > 1);
function actionContext() {
return context || (containerKind === "case" ? { kind: "case", id: containerId } : { kind: "matter", id: containerId });
}
async function setBezug(elementId, refersToId) {
if (!refersToId) return;
setPending(true);
setError("");
try {
await api(`/api/v1/elements/${elementId}/references`, {
method: "POST",
body: { refers_to_element_id: refersToId, context: actionContext() },
});
await onChange();
} catch (err) {
setError(err.message);
} finally {
setPending(false);
}
}
async function clearBezug(elementId, refersToId) {
setPending(true);
setError("");
try {
const action = actionContext();
const search = new URLSearchParams({ context_kind: action.kind, context_id: action.id });
await api(`/api/v1/elements/${elementId}/references/${refersToId}?${search}`, { method: "DELETE" });
await onChange();
} catch (err) {
setError(err.message);
} finally {
setPending(false);
}
}
async function removeBinding(binding, everywhere) {
const element = binding.element;
if (everywhere) {
@@ -781,8 +888,9 @@ export function ContentBoard({
const href = itemHref(binding);
const text = blurb(element);
const sourceSymbol = contentSourceSymbol(element);
const linked = (element.refers_to || []).length || (element.referred_by || []).length;
return (
<li key={binding.id} data-binding={binding.id} className={`preview-row${draggingId === binding.id ? " is-dragging" : ""}${selectedId === binding.id ? " is-selected" : ""}`}>
<li key={binding.id} data-binding={binding.id} className={`preview-row${linked ? " preview-row--linked" : ""}${draggingId === binding.id ? " is-dragging" : ""}${selectedId === binding.id ? " is-selected" : ""}`}>
{indicator?.sectionId === section.id && indicator?.kind !== "chapter" && indicator.index === index ? <div className="insert-line" /> : null}
{canSort && custom ? (
<button
@@ -822,7 +930,7 @@ export function ContentBoard({
<TypeGlyph name={sourceSymbol} tone="dark" size={16} />
</span>
) : null}
{formatDate(fachDate(element))} · {sourceLabel(element)}
{formatDate(fachDate(element))} · {elementFacts(element)}
</span>
{text ? <span className="preview-row__text">{text}</span> : null}
{binding.origin ? <span className="preview-row__origin">{binding.origin}{binding.shared ? " · weitere Einbindung" : ""}</span> : null}
@@ -830,8 +938,30 @@ export function ContentBoard({
<span className="preview-row__origin">Kapitel {(chapters.find((chapter) => chapter.id === binding.chapter_id)?.title) || ""}</span>
) : null}
</Link>
<BezugLines element={element} source={source} onOpen={onOpen} itemHref={itemHref} />
{(canEdit || (canSort && custom) || (canSort && chapters.length)) ? (
<div className="preview-row__actions">
{canEdit ? (
<details className="row-menu">
<summary>Bezug</summary>
<label>
Bezug auf
<select value="" disabled={pending} onChange={(event) => setBezug(element.id, event.target.value)}>
<option value="">Unterlage wählen</option>
{source.filter((item) => item.element?.id && item.element.id !== element.id).map((item) => (
<option key={item.element.id} value={item.element.id}>
{formatDate(item.element.dates?.document_on)} · {item.element.title}
</option>
))}
</select>
</label>
{(element.refers_to || []).map((item) => (
<button key={item.id} type="button" onClick={() => clearBezug(element.id, item.id)}>
Bezug auf {item.title} lösen
</button>
))}
</details>
) : null}
{canEdit ? (
<details className="row-menu">
<summary>Entfernen</summary>
+116 -13
View File
@@ -366,6 +366,7 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
}
.modal__bar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.modal.modal--wide { width: min(960px, 100%); }
.modal.modal--wide.modal--split { width: min(1120px, 100%); }
.modal h2 { font-size: 18px; color: var(--text1); text-transform: none; letter-spacing: 0; margin: 0; }
.modal h3 { font-size: 13px; }
@@ -468,10 +469,11 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.folder-tree ul { margin-left: 11px; padding-left: 8px; border-left: 1px solid var(--border); }
.folder-row { display: flex; align-items: center; gap: 0; min-height: 28px; border-radius: 4px; }
.folder-row.is-current { background: var(--accent-light); }
.folder-twist, .folder-name { background: transparent; border: 0; color: inherit; min-height: 28px; padding: 0; }
.folder-twist, .folder-name { background: transparent; border: 0; color: inherit; min-height: 28px; padding: 0; justify-content: flex-start; text-align: left; }
.folder-twist { width: 22px; flex: none; }
.folder-name { flex: 1; display: flex; align-items: center; gap: 6px; text-align: left; padding: 2px 6px; font: inherit; font-weight: 500; cursor: pointer; min-width: 0; }
.folder-name svg { width: 16px; height: 16px; flex: none; }
.folder-name { flex: 1; display: flex; align-items: flex-start; gap: 6px; text-align: left; padding: 2px 6px; font: inherit; font-weight: 500; cursor: pointer; min-width: 0; line-height: 1.3; }
.folder-name span { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; }
.folder-name svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.order-choice { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; max-width: 36rem; font-size: 14px; }
.order-choice select { width: auto; min-width: 16rem; flex: 1; }
.target-line { margin: 0; color: var(--text2); overflow-wrap: break-word; }
@@ -614,7 +616,8 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border:
.menu-list button { width: 100%; justify-content: flex-start; }
.placements { margin: 4px 0 0; overflow-wrap: anywhere; }
.reader-preview { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); }
.mailbox { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 0; }
.mailbox { display: grid; grid-template-columns: minmax(180px, 220px) minmax(0, 1fr); gap: 12px; align-items: stretch; min-height: 0; }
.mailbox.mailbox--read { grid-template-columns: minmax(160px, 200px) minmax(220px, 0.9fr) minmax(260px, 1.15fr); }
.mailbox__folders { border-right: 1px solid var(--border); padding-right: 8px; overflow: auto; min-height: 0; }
.mailbox__folders { display: block; }
.modal.modal--split {
@@ -631,11 +634,13 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border:
.mail-list { display: grid; }
.mail-row {
display: grid;
grid-template-columns: 6.5rem minmax(0, 1fr);
gap: 2px 12px;
grid-template-columns: 4.6rem minmax(0, 1fr) auto;
gap: 1px 8px;
align-items: start;
justify-content: stretch;
width: 100%;
min-height: 58px;
padding: 8px 10px;
min-height: 0;
padding: 5px 8px;
border: 0;
border-top: 1px solid var(--border);
border-radius: 0;
@@ -643,10 +648,106 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border:
color: inherit;
text-align: left;
font-weight: 500;
line-height: 1.3;
}
.mail-row.is-current { background: var(--accent-light); }
.mail-row__date { color: var(--text2); font-size: 12px; font-variant-numeric: tabular-nums; }
.mail-row__main { display: grid; min-width: 0; text-align: left; }
.mail-row__main strong, .mail-row__main span { overflow-wrap: anywhere; text-align: left; }
.mail-row__main span { color: var(--text2); font-size: 12px; font-weight: 500; }
.mail-row__files {
min-width: 1.4rem;
padding: 0 5px;
border-radius: 999px;
background: var(--surface2);
color: var(--text2);
font-size: 12px;
text-align: center;
}
.mail-preview {
min-height: 0;
overflow: auto;
border-left: 1px solid var(--border);
padding-left: 12px;
display: grid;
align-content: start;
gap: 6px;
}
.mail-preview h3 { font-size: 16px; }
.mail-preview p, .mail-letter p { margin: 0; overflow-wrap: anywhere; }
.mail-preview p span, .mail-letter p span { display: inline-block; min-width: 3.2rem; color: var(--text3); font-size: 12px; font-weight: 700; }
.mail-preview__party { font-weight: 700; }
.mail-files { margin: 0; padding-left: 1.1rem; }
.preview-row--linked { box-shadow: inset 3px 0 0 var(--accent); }
.bezug { flex: 1 1 100%; display: grid; gap: 2px; min-width: 0; }
.bezug__link, a.bezug__link, p.bezug__link {
display: flex;
flex-wrap: wrap;
align-items: baseline;
justify-content: flex-start;
gap: 8px;
width: 100%;
min-height: 0;
margin: 0;
padding: 2px 0 2px 10px;
border: 0;
border-left: 2px solid var(--accent);
border-radius: 0;
background: transparent;
color: var(--text2);
text-align: left;
font: inherit;
font-size: 13px;
font-weight: 500;
text-decoration: none;
cursor: pointer;
}
.bezug__link--reply, a.bezug__link--reply { border-left-color: var(--border2); }
p.bezug__link { cursor: default; }
.bezug__link span { color: var(--text3); font-size: 12px; font-weight: 700; }
.bezug__link strong { color: var(--text1); font-weight: 650; overflow-wrap: anywhere; }
.bezug__link em { font-style: normal; color: var(--text3); }
.schriftwechsel {
display: grid;
gap: 0;
margin: 0 0 14px;
padding: 8px 10px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
}
.schriftwechsel h3 { margin: 0 0 4px; font-size: 13px; }
.schriftwechsel > p { margin: 0 0 8px; color: var(--text3); font-size: 12px; line-height: 1.4; }
.schriftwechsel__item {
display: grid;
grid-template-columns: 6.4rem minmax(0, 1fr) auto;
gap: 8px;
align-items: baseline;
justify-content: start;
width: 100%;
min-height: 0;
padding: 5px 0 5px 10px;
border: 0;
border-left: 2px solid var(--border2);
border-radius: 0;
background: transparent;
color: inherit;
text-align: left;
font: inherit;
font-weight: 500;
cursor: pointer;
}
.schriftwechsel__item.is-current { border-left-color: var(--accent); font-weight: 700; cursor: default; }
.schriftwechsel__item span, .schriftwechsel__item em { color: var(--text3); font-style: normal; font-size: 12px; font-weight: 600; }
.schriftwechsel__item strong { overflow-wrap: anywhere; font-weight: inherit; }
.mail-letter { display: grid; gap: 6px; align-content: start; }
.mail-letter__body {
margin: 0;
white-space: pre-wrap;
overflow-wrap: anywhere;
font: inherit;
color: var(--text1);
}
.mail-row strong { grid-column: 2; grid-row: 1; overflow-wrap: anywhere; }
.mail-row span:first-child { grid-column: 1; grid-row: 1 / span 2; color: var(--text2); font-size: 13px; }
.mail-row span:last-child { grid-column: 2; color: var(--text2); font-size: 13px; overflow-wrap: anywhere; }
@media (min-width: 900px) {
.record-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); }
@@ -667,8 +768,10 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border:
.outline__body { display: none; }
.outline.is-open .outline__body { display: block; }
.outline__toggle { display: inline-flex; margin-bottom: 8px; }
.mailbox { grid-template-columns: 1fr; grid-template-rows: minmax(140px, 34%) minmax(0, 1fr); min-height: 0; }
.mailbox__folders { display: block; max-height: none; overflow: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; }
.mailbox, .mailbox.mailbox--read { grid-template-columns: 1fr; grid-template-rows: minmax(120px, 30%) minmax(0, 1fr); min-height: 0; }
.mailbox.mailbox--read { grid-template-rows: minmax(110px, 24%) minmax(140px, 34%) minmax(180px, 1fr); }
.mailbox__folders, .mail-preview { border-right: 0; border-left: 0; padding-left: 0; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.mailbox__folders { display: block; max-height: none; overflow: auto; }
}
@media (prefers-color-scheme: dark) {