Skip to content

feat(FastAPI): add pkgbase comments (new, edit)

Kevin Morris requested to merge kevr/aurweb:pu_comments into pu

feat(FastAPI): add pkgbase comments (new, edit)

In PHP, this was implemented using an /rpc type 'get-comment-form'. With FastAPI, we've decided to reorganize this into a non-RPC route: /pkgbase/{name}/comments/{id}/form, rendered via the new templates/partials/packages/comment_form.html template.

When the comment_form.html template is provided a comment object, it will produce an edit comment form. Otherwise, it will produce a new comment form.

A few new FastAPI routes have been introduced:

  • GET /pkgbase/{name}/comments/{id}/form
    • Produces a JSON response based on {"form": "<form_markup>"}.
  • POST `/pkgbase/{name}/comments'
    • Creates a new comment.
  • POST /pkgbase/{name}/comments/{id}
    • Edits an existing comment.

In addition, some Javascript has been modified for our new routes.

Signed-off-by: Kevin Morris kevr@0cost.org

Closes: #52 (closed)

Merge request reports

Loading