Renaming of symbols. Functions, variables, values, DB values, etc.
Basically everything that is not user-facing.
This only covers "Trusted User" things:
tests, comments, etc. will covered in a following commit.
The queries being done on the package search page are quite costly.
(Especially the default one ordered by "Popularity" when navigating to /packages)
Let's add the search results to the Redis cache:
Every result of a search query is being pushed to Redis until we hit our maximum of 50k.
An entry expires after 3 minutes before it's evicted from the cache.
Lifetime an Max values are configurable.
Signed-off-by: moson-mo <mo-son@mailbox.org>
- Add package name textbox for filtering requests (with auto-suggest)
- Make "x pending requests" a link for TU/Dev on the package details page
Signed-off-by: moson-mo <mo-son@mailbox.org>
Improves performance for queries with large result sets.
The "group by" clause can be removed for all search types but the keywords.
Signed-off-by: moson-mo <mo-son@mailbox.org>
Fixes:
Keyword-links on the package page pass wrong query-parameter.
Thus a name/description search is performed instead of keywords
Issue report: #397
Signed-off-by: moson-mo <mo-son@mailbox.org>
Fix glitch on the package page:
"Show more..." not displayed for the "Required by" list
Fix test case:
Function name does not start with "test" hence it was never executed during test runs
Issue report: #363
Signed-off-by: moson-mo <mo-son@mailbox.org>
FastAPI 0.87.0 switched to the httpx library for their TestClient
* cookies need to be defined on the request instance instead of method calls
Signed-off-by: moson-mo <mo-son@mailbox.org>
FastAPI 0.87.0 switched to the httpx library for their TestClient
* allow_redirects is deprecated and replaced by follow_redirects
Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit fixes two of our tests in test_templates.py to go along
with our new template modifications, as well as a new test in
test_packages_routes.py which constructs two packages belonging
to the same package base, then tests that viewing their pages
produces their independent descriptions.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This patch does not include a javascript implementating, but
provides a pure HTML/HTTP method of paging through these lists.
Also fixes erroneous limiting. We now use a hardcoded limit of 20
by default.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This causes an issue that should have been obvious from the get-go:
if a package request is up in the AUR, but the package has already
been picked up by an official repository, we would end up returning
a 404 here, leading a TU to not be able to perform an action for
a request's target.
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>
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>
- 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>
This commit changes several things about how we were handling
package requests.
Modifications (requests):
-------------
- `/requests/{id}/close` no longer provides an Accepted selection.
All manual request closures will cause a rejection.
- Relevent `pkgbase` actions now trigger request closures:
`/pkgbase/{name}/delete` (deletion), `/pkgbase/{name}/merge` (merge)
and `/pkgbase/{name}/disown` (orphan).
- Comment fields have been added to
`/pkgbase/{name}/{delete,merge,disown}`, which is used to set the
`PackageRequest.ClosureComment` on pending requests. If the comment
field is left blank, a closure comment is autogenerated.
- Autogenerated request notifications are only sent out once
as a closure notification.
- Some markup has been fixed.
Modifications (disown/orphan):
-----------------------------
- Orphan requests are now handled through the same path as
deletion/merge.
- We now check for due date when disowning as non-maintainer;
previously, this was only done for display and not functionally.
This check applies to Trusted Users' disowning of a package.
This style of notification flow does reduce our visibility, but
accounting can still be done via the close request; it includes
the action, pkgbase name and the user who accepted it.
Closes#204
Signed-off-by: Kevin Morris <kevr@0cost.org>
Didn't get this in when the initial request port went down;
here it is.
Auto-accept orphan requests when the package has been out of
date for longer than auto_orphan_age.
Auto-accept deletion requests by the package's maintainer
if the package has been uploaded within auto_deletion_age
seconds ago.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This change utilizes pytest-xdist to perform a multiproc test
run and reworks aurweb.db's code. We no longer use a global
engine, session or Session, but we now use a memo of engines
and sessions as they are requested, based on the PYTEST_CURRENT_TEST
environment variable, which is available during testing.
Additionally, this change strips several SQLite components
out of the Python code-base.
SQLite is still compatible with PHP and sharness tests, but
not with our FastAPI implementation.
More changes:
------------
- Remove use of aurweb.db.session global in other code.
- Use new aurweb.db.name() dynamic db name function in env.py.
- Added 'addopts' to pytest.ini which utilizes multiprocessing.
- Highly recommended to leave this be or modify `-n auto` to
`-n {cpu_threads}` where cpu_threads is at least 2.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This is needed so that users can edit comments when they don't have
Javascript being used in their browser.
Signed-off-by: Kevin Morris <kevr@0cost.org>
This definitely leaked through in more areas. We'll need to reuse
this new utility function in a few other routes in upcoming commits.
Signed-off-by: Kevin Morris <kevr@0cost.org>
With this change, we've decoupled some partials shared between
`/pkgbase/{name}` and `/account/{username}/comments`. The comment
actions template now resolves its package base via the `comment`
instance instead of requiring `pkgbase`.
We've also modified the existing package comment routes to
support execution from any location using the `next` parameter.
This allows us to reuse code from package comments for
account comments actions.
Moved the majority of comment editing javascript to its own
.js file.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Changes:
- `via` is not required in FastAPI. We deduce the involved
requests via their PackageBaseName / MergeBaseName columns
and set them to Accepted when merged.
- When erroneous input is given, the error is now presented
on the merge page instead of sending the user to the pkgbase
page.
Signed-off-by: Kevin Morris <kevr@0cost.org>
Improvements:
- Package deletion now creates a PackageRequest on behalf of
the deleter if one does not yet exist.
- All package deletions are now logged to keep track of who did what.
Signed-off-by: Kevin Morris <kevr@0cost.org>