Skip to content

[Draft] feat(FastAPI): add /packages (post)

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

This MR includes an initial implementation of POST /packages, as well as support for all of the actions that can be found in the form located at the bottom of the search results (for logged in users).

A detail was overlooked here: We need to be mailing our request creations (including package deletion when there is no request for it) to the aur-requests ML; see PHP's implementation.

[FastAPI] add /packages (post)

This route accepts an "action" form input, along with "IDs",
which is a list of package IDs to perform the action against.

Improvements:

* Errors
    * PHP omits various errors that it seems to want to support
      (they have translations found in ./po/), FastAPI shows them
      all, along with a new error which does not yet have a
      translation: "The package base you want to merge into does not
      exist." which is used when the given name of a package base
      in the `merge_into` text input cannot be found.
    * Additionally, we now supply a "success" as well, which shows
      green success text when an action was successful. This does
      not happen on the PHP instance and it's a bit confusing to the
      user.

Modifications:

* Errors
    * As far as the action form is concerned, there are various
      situations where PHP's implementation omits showing an error
      or any success message on submission. We address these
      shortcomings here.
    * We now display success messages in most cases.
    * We now display a new error when no packages are selected
      during adoption: "You do not have permission to adopt these
      packages." This is a bit inaccurate, but we have a translation
      for it, so its being reused here.
    * We now display a new error when no packages are selected
      during deletion: "You did not select any packages to delete."
    * We now display a new error when a `merge_into` is specified,
      but no PackageBase by that name exists: "The package base you
      want to merge into does not exist." -- This is untranslated
      currently, we need to get this added into Transifex so we
      can source them from the community like our other translations.
    * The `notify` and `unnotify` actions remain untouched in terms
      of error/success display.
Edited by Kevin Morris

Merge request reports

Loading