Now, when we want to add, remove routes, our base routes should
be defined in aurweb.routers.__init__.APP_ROUTES.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Move package request routes and related routes to their
respective routers. In addition, move some utility used
for requests over from `aurweb.packages`.
Introduced routers:
- `aurweb.routers.requests`
Introduced package:
- `aurweb.requests`
Introduced module:
- `aurweb.requests.util`
Changes:
- Moved `aurweb.packages.validate` to `aurweb.pkgbase.validate`
- Moved requests listing & request closure routes to
`aurweb.routers.requests`
- Moved pkgbase request creation route to `aurweb.routers.pkgbase`
- Moved `get_pkgreq_by_id` from `aurweb.packages.util` to
`aurweb.requests.util` and fixed its return type hint.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Introduces new router:
- `aurweb.routers.pkgbase`
Introduces new package:
- `aurweb.pkgbase`
Introduces new modules:
- `aurweb.pkgbase.actions`
- `aurweb.pkgbase.util`
Changes:
- `pkgbase_{action}_instance` functions are now located in
`aurweb.pkgbase.actions`.
- `pkgbase`-wise routes have been moved to
`aurweb.routers.pkgbase`.
- `make_single_context` was moved to
`aurweb.pkgbase.util.make_context`.
Signed-off-by: Kevin Morris <kevr@0cost.org>
`delete_package` was processing package deletions through `Package`
instances. This doesn't make sense; if we delete a package, we want
to target its package base.
This new function vastly simplifies the previous.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Previously, when the relationship was None, an <a> would still
wrap the None value erroneously. This addresses that for all
three user fields.
In addition, this commit adds direct testing for the
`templates/partials/packages/details.html` template.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This new constructor is a beginning to making Request a bit more easy
to deal with for standard testing needs. With this commit, users can
now specify a `user` and `authenticated` state while constructing a
Request:
request = Request(user=some_user, authenticated=True)
By default, the `authenticated` kwarg is set to False and `user` is
set to `aurweb.testing.requests.User()`.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit centralizes comaintainer management with a few new
functions and uses them more appropriately within routes:
- aurweb.packages.util.latest_priority
- aurweb.packages.util.remove_comaintainer
- aurweb.packages.util.remove_comaintainers
- aurweb.packages.util.add_comaintainer
- aurweb.packages.util.add_comaintainers
- aurweb.packages.util.rotate_comaintainers
Closes#117
Signed-off-by: Kevin Morris <kevr@0cost.org>
While this does make more sense to me personally, there is no need
to change how the AUR treats its users; it has been accepted for
ages and not found to be ridden with flaws. Stay with the tried
and true method.
Signed-off-by: Kevin Morris <kevr@0cost.org>
- Use queries more closely aligned to PHP's implementation; removes
the need for separate vote/notification queries.
- Default sort by popularity
Closes#214
Signed-off-by: Kevin Morris <kevr@0cost.org>
Previous versions when encountered with an updated `importlib_metadata`
produce a deprecation warning. This update resolves that deprecation.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Instead of allowing an exception to propogate through the framework
routes, catch it and log out an error about notifications not being
sent.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit also decouples testing regarding this feature
into several test functions.
Signed-off-by: Kevin Morris <kevr@0cost.org>
bump
Signed-off-by: Kevin Morris <kevr@0cost.org>
This will ensure the state of `request.user` is good to go
for any other users which obtain it after the backend.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Workflow has changed and TUs should now depend on actions taken closing
requests which exist for the package base (deletion, merge, disown|orphan).
The `/requests/{id}/close` route is now purely used for rejecting
requests. The deletion, merge and orphan closures have been added
into their related action routes. See the lists below.
Disowning can only be done if an existing orphan request can be found
for the action by TUs. Maintainers can disown their own packages at
any time.
Actions which provide request closures:
--------------------------------------
- `/pkgbase/{name}/delete`: deletion request closure
- `/pkgbase/{name}/merge`: merge request closure
- `/pkgbase/{name}/disown`: orphan request closure
To close a request:
------------------
- `/requests/{id}/close`: close a request with rejected status
For deletion and merge actions, if no request yet exists, one
will be autogenerated and closed.
For orphan requests, a preexisting require is required and an
error is now returned in cases where one cannot be found.
For all closure actions, if the new comments field is left empty,
a closure comment will be autogenerated.
Note: This is a documentation commit summing up UX changes from
recent commits.
Signed-off-by: Kevin Morris <kevr@0cost.org>