From 4b6412734b53a345e41d0531f03ff1c2318e9f55 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 21 Mar 2026 18:30:05 +0000 Subject: [PATCH] fix(comments): address code review feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add onupdate=sa.func.now() to migration updated_at columns - Use UserProfile.is_blocked.is_(False) instead of == False - Fix British to American spelling (organised → organized) Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/3894af37-0f19-457b-8811-f1feb18b17ef --- app/api/comments.py | 9 ++------- docs/API.md | 2 +- .../041_add_document_comments_and_annotations.py | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/api/comments.py b/app/api/comments.py index b4a39220..cb4451eb 100644 --- a/app/api/comments.py +++ b/app/api/comments.py @@ -138,7 +138,7 @@ def _build_thread_tree(comments: list[DocumentComment]) -> list[dict[str, Any]]: @router.get("/files/{file_id}/comments") @require_login def list_comments(request: Request, file_id: int, db: DbSession): - """List all comments for a document, organised into threads. + """List all comments for a document, organized into threads. Returns a threaded tree where top-level comments contain nested ``replies``. @@ -663,12 +663,7 @@ def list_mentionable_users(request: Request, db: DbSession): Returns: A list of ``{user_id, display_name}`` objects. """ - profiles = ( - db.query(UserProfile) - .filter(UserProfile.is_blocked == False) # noqa: E712 - .order_by(UserProfile.display_name) - .all() - ) + profiles = db.query(UserProfile).filter(UserProfile.is_blocked.is_(False)).order_by(UserProfile.display_name).all() return [ { diff --git a/docs/API.md b/docs/API.md index 97b79294..6ee5f41f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2920,7 +2920,7 @@ Threaded comments and PDF annotations for document collaboration. **GET** `/api/files/{file_id}/comments` -Returns all comments for a document, organised into a threaded tree. +Returns all comments for a document, organized into a threaded tree. **Response (200):** ```json diff --git a/migrations/versions/041_add_document_comments_and_annotations.py b/migrations/versions/041_add_document_comments_and_annotations.py index f0aac21a..3bb84339 100644 --- a/migrations/versions/041_add_document_comments_and_annotations.py +++ b/migrations/versions/041_add_document_comments_and_annotations.py @@ -34,7 +34,7 @@ def upgrade() -> None: sa.Column("mentions", sa.Text(), nullable=True), sa.Column("is_resolved", sa.Boolean(), nullable=False, server_default="0"), sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()), - sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()), + sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now()), sa.ForeignKeyConstraint(["file_id"], ["files.id"]), sa.ForeignKeyConstraint(["parent_id"], ["document_comments.id"]), sa.PrimaryKeyConstraint("id"), @@ -59,7 +59,7 @@ def upgrade() -> None: sa.Column("annotation_type", sa.String(50), nullable=False, server_default="note"), sa.Column("color", sa.String(20), nullable=True), sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now()), - sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now()), + sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), onupdate=sa.func.now()), sa.ForeignKeyConstraint(["file_id"], ["files.id"]), sa.PrimaryKeyConstraint("id"), )