Merge pull request #6585 from robyroro/codex/notes-clear-fields

fix(notes): persist removal of optional note fields
This commit is contained in:
Alexandre Teixeira
2026-10-30 19:43:01 +00:00
committed by GitHub
2 changed files with 94 additions and 9 deletions
+12 -9
View File
@@ -728,32 +728,35 @@ def setup_note_routes(task_scheduler=None, upload_handler=None):
)
if body.title is not None:
note.title = body.title
if body.content is not None:
# Omitted fields preserve their values; explicit null clears the
# nullable fields used by the editor's removal controls.
supplied = body.model_fields_set
if "content" in supplied:
note.content = body.content
if body.items is not None:
note.items = json.dumps(body.items)
if "items" in supplied:
note.items = json.dumps(body.items) if body.items is not None else None
flag_modified(note, "items")
if body.note_type is not None:
note.note_type = body.note_type
if body.color is not None:
if "color" in supplied:
note.color = body.color
if body.label is not None:
if "label" in supplied:
note.label = body.label
if body.pinned is not None:
note.pinned = body.pinned
if body.archived is not None:
note.archived = body.archived
if body.due_date is not None:
if "due_date" in supplied:
note.due_date = body.due_date
if body.image_url is not None:
if "image_url" in supplied:
note.image_url = body.image_url
if body.gallery_id is not None:
if "gallery_id" in supplied:
note.gallery_id = body.gallery_id
if body.repeat is not None:
note.repeat = body.repeat
if body.sort_order is not None:
note.sort_order = body.sort_order
if body.agent_session_id is not None:
if "agent_session_id" in supplied:
note.agent_session_id = body.agent_session_id
db.commit()