feat: return-to-project redirects from create/edit forms

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 18:28:41 +00:00
parent 7c724f05dd
commit 404ead7596
18 changed files with 125 additions and 27 deletions

View File

@@ -122,6 +122,8 @@ async def create_note(
return RedirectResponse(url=f"/meetings/{meeting_id}?tab=notes", status_code=303)
if focus_id and focus_id.strip():
return RedirectResponse(url=f"/focus/{focus_id}?tab=notes", status_code=303)
if project_id and project_id.strip():
return RedirectResponse(url=f"/projects/{project_id}?tab=notes", status_code=303)
return RedirectResponse(url=f"/notes/{note['id']}", status_code=303)
@@ -153,7 +155,7 @@ async def note_detail(note_id: str, request: Request, db: AsyncSession = Depends
@router.get("/{note_id}/edit")
async def edit_form(note_id: str, request: Request, db: AsyncSession = Depends(get_db)):
async def edit_form(note_id: str, request: Request, from_project: Optional[str] = None, db: AsyncSession = Depends(get_db)):
repo = BaseRepository("notes", db)
sidebar = await get_sidebar_data(db)
item = await repo.get(note_id)
@@ -168,6 +170,7 @@ async def edit_form(note_id: str, request: Request, db: AsyncSession = Depends(g
"domains": domains, "projects": projects,
"page_title": f"Edit Note", "active_nav": "notes",
"item": item, "prefill_domain_id": "", "prefill_project_id": "",
"from_project": from_project or "",
})
@@ -180,6 +183,7 @@ async def update_note(
body: Optional[str] = Form(None),
content_format: str = Form("rich"),
tags: Optional[str] = Form(None),
from_project: Optional[str] = Form(None),
db: AsyncSession = Depends(get_db),
):
repo = BaseRepository("notes", db)
@@ -193,6 +197,12 @@ async def update_note(
else:
data["tags"] = None
await repo.update(note_id, data)
new_project = data.get("project_id")
if from_project and from_project.strip():
if new_project and new_project != from_project:
return RedirectResponse(url=f"/projects/{new_project}?tab=notes", status_code=303)
return RedirectResponse(url=f"/projects/{from_project}?tab=notes", status_code=303)
return RedirectResponse(url=f"/notes/{note_id}", status_code=303)