From 3ee15bfc24f026e78ea8b9fa97541c1cb0d561de Mon Sep 17 00:00:00 2001 From: moson Date: Sun, 10 Sep 2023 10:01:21 +0200 Subject: [PATCH] housekeep: TU rename - Comments Changes to comments, function descriptions, etc. Signed-off-by: moson --- INSTALL | 5 ----- aurweb/routers/package_maintainer.py | 6 +++--- conf/config.defaults | 4 ++-- doc/git-interface.txt | 2 +- doc/maintenance.txt | 2 +- schema/gendummydata.py | 14 +++++++------- static/css/archweb.css | 2 +- templates/requests.html | 2 +- test/test_accounts_routes.py | 18 +++++++++--------- test/test_notify.py | 2 +- test/test_package_maintainer_routes.py | 20 ++++++++++---------- test/test_packages_routes.py | 8 ++++---- test/test_pkgbase_routes.py | 6 +++--- test/test_requests.py | 4 ++-- test/test_user.py | 6 +++--- 15 files changed, 48 insertions(+), 53 deletions(-) diff --git a/INSTALL b/INSTALL index c6c71ca7..c6fdf8af 100644 --- a/INSTALL +++ b/INSTALL @@ -30,11 +30,6 @@ read the instructions below. ssl_certificate /etc/ssl/certs/aur.cert.pem; ssl_certificate_key /etc/ssl/private/aur.key.pem; - # TU Bylaws redirect. - location = /trusted-user/TUbylaws.html { - return 301 https://tu-bylaws.aur.archlinux.org; - } - # smartgit location. location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" { include uwsgi_params; diff --git a/aurweb/routers/package_maintainer.py b/aurweb/routers/package_maintainer.py index f358b453..4ccb25b0 100644 --- a/aurweb/routers/package_maintainer.py +++ b/aurweb/routers/package_maintainer.py @@ -20,7 +20,7 @@ from aurweb.templates import make_context, make_variable_context, render_templat router = APIRouter() logger = aur_logging.get_logger(__name__) -# Some TU route specific constants. +# Some PM route specific constants. ITEMS_PER_PAGE = 10 # Paged table size. MAX_AGENDA_LENGTH = 75 # Agenda table column length. @@ -153,7 +153,7 @@ def render_proposal( vote: models.TUVote, status_code: HTTPStatus = HTTPStatus.OK, ): - """Render a single TU proposal.""" + """Render a single PM proposal.""" context["proposal"] = proposal context["voteinfo"] = voteinfo context["voters"] = voters.all() @@ -368,7 +368,7 @@ async def package_maintainer_addvote_post( duration, quorum = ADDVOTE_SPECIFICS.get(type) timestamp = time.utcnow() - # Active TU types we filter for. + # Active PM types we filter for. types = {PACKAGE_MAINTAINER_ID, PACKAGE_MAINTAINER_AND_DEV_ID} # Create a new TUVoteInfo (proposal)! diff --git a/conf/config.defaults b/conf/config.defaults index ab0a9b67..8b0d8787 100644 --- a/conf/config.defaults +++ b/conf/config.defaults @@ -159,9 +159,9 @@ commit_url = https://gitlab.archlinux.org/archlinux/aurweb/-/commits/%s ;commit_hash = 1234567 [tuvotereminder] -; Offsets used to determine when TUs should be reminded about +; Offsets used to determine when Package Maintainers should be reminded about ; votes that they should make. -; Reminders will be sent out for all votes that a TU has not yet +; Reminders will be sent out for all votes that a Package Maintainer has not yet ; voted on based on `now + range_start <= End <= now + range_end`. range_start = 500 range_end = 172800 diff --git a/doc/git-interface.txt b/doc/git-interface.txt index 334c3759..39c2b487 100644 --- a/doc/git-interface.txt +++ b/doc/git-interface.txt @@ -109,7 +109,7 @@ is also recommended to disable automatic garbage collection by setting receive.autogc to false. Remember to periodically run `git gc` manually or setup a maintenance script which initiates the garbage collection if you follow this advice. For gc.pruneExpire, we recommend "3.months.ago", such that commits -that became unreachable by TU intervention are kept for a while. +that became unreachable by Package Maintainer intervention are kept for a while. Script Wrappers (poetry) ------------------------ diff --git a/doc/maintenance.txt b/doc/maintenance.txt index f50202a5..a828abd4 100644 --- a/doc/maintenance.txt +++ b/doc/maintenance.txt @@ -63,7 +63,7 @@ computations and clean up the database: packages that are in the official repositories already. * aurweb-tuvotereminder sends out reminders to TUs if the voting period for a - TU proposal ends soon. + Package Maintainer proposal ends soon. * aurweb-popupdate is used to recompute the popularity score of packages. diff --git a/schema/gendummydata.py b/schema/gendummydata.py index d79331af..6049d41e 100755 --- a/schema/gendummydata.py +++ b/schema/gendummydata.py @@ -26,7 +26,7 @@ PKG_ID = 1 # Packages.ID of first package # how many users to 'register' MAX_USERS = int(os.environ.get("MAX_USERS", 38000)) MAX_DEVS = 0.1 # what percentage of MAX_USERS are Developers -MAX_TUS = 0.2 # what percentage of MAX_USERS are Package Maintainers +MAX_PMS = 0.2 # what percentage of MAX_USERS are Package Maintainers # how many packages to load MAX_PKGS = int(os.environ.get("MAX_PKGS", 32000)) PKG_DEPS = (1, 15) # min/max depends a package has @@ -35,9 +35,9 @@ PKG_SRC = (1, 3) # min/max sources a package has PKG_CMNTS = (1, 5) # min/max number of comments a package has CATEGORIES_COUNT = 17 # the number of categories from aur-schema VOTING = (0, 0.001) # percentage range for package voting -# number of open trusted user proposals +# number of open package maintainer proposals OPEN_PROPOSALS = int(os.environ.get("OPEN_PROPOSALS", 15)) -# number of closed trusted user proposals +# number of closed package maintainer proposals CLOSE_PROPOSALS = int(os.environ.get("CLOSE_PROPOSALS", 50)) RANDOM_TLDS = ("edu", "com", "org", "net", "tw", "ru", "pl", "de", "es") RANDOM_URL = ("http://www.", "ftp://ftp.", "http://", "ftp://") @@ -153,7 +153,7 @@ while len(seen_pkgs) < MAX_PKGS: # contents = None -# developer/tu IDs +# developer/PM IDs # developers = [] packagemaintainers = [] @@ -179,10 +179,10 @@ for u in user_keys: if len(developers) >= MAX_DEVS * MAX_USERS: has_devs = 1 elif account_type == 2 and not has_pms: - # this will be a trusted user account + # this will be a package maintainer account # packagemaintainers.append(seen_users[u]) - if len(packagemaintainers) >= MAX_TUS * MAX_USERS: + if len(packagemaintainers) >= MAX_PMS * MAX_USERS: has_pms = 1 else: # a normal user account @@ -339,7 +339,7 @@ for p in seen_pkgs_keys: s = s % (seen_pkgs[p], src) out.write(s) -# Create trusted user proposals +# Create package maintainer proposals # log.debug("Creating SQL statements for package maintainer proposals.") count = 0 diff --git a/static/css/archweb.css b/static/css/archweb.css index 0c0b235d..2d0728c4 100644 --- a/static/css/archweb.css +++ b/static/css/archweb.css @@ -1044,7 +1044,7 @@ table td.country { stroke-width: 1.5px; } -/* dev/TU biographies */ +/* dev/PM biographies */ #arch-bio-toc { width: 75%; margin: 0 auto; diff --git a/templates/requests.html b/templates/requests.html index 352ed820..a6b2ae46 100644 --- a/templates/requests.html +++ b/templates/requests.html @@ -179,7 +179,7 @@ {{ "Locked" | tr }} ({{ time_left_fmt }}) {% else %} - {# Only elevated users (TU or Dev) are allowed to accept requests. #} + {# Only elevated users (PM or Dev) are allowed to accept requests. #} {{ "Accept" | tr }} diff --git a/test/test_accounts_routes.py b/test/test_accounts_routes.py index b9d4ec7c..c8fdf25b 100644 --- a/test/test_accounts_routes.py +++ b/test/test_accounts_routes.py @@ -658,7 +658,7 @@ def test_post_register_with_ssh_pubkey(client: TestClient): def test_get_account_edit_pm_as_pm(client: TestClient, pm_user: User): - """Test edit get route of another TU as a TU.""" + """Test edit get route of another PM as a PM.""" with db.begin(): user2 = create_user("test2") user2.AccountTypeID = at.PACKAGE_MAINTAINER_ID @@ -685,7 +685,7 @@ def test_get_account_edit_pm_as_pm(client: TestClient, pm_user: User): def test_get_account_edit_as_tu(client: TestClient, pm_user: User): - """Test edit get route of another user as a TU.""" + """Test edit get route of another user as a PM.""" with db.begin(): user2 = create_user("test2") @@ -1287,14 +1287,14 @@ def test_post_account_edit_other_user_type_as_tu( cookies = {"AURSID": pm_user.login(Request(), "testPassword")} endpoint = f"/account/{user2.Username}/edit" - # As a TU, we can see the Account Type field for other users. + # As a PM, we can see the Account Type field for other users. with client as request: request.cookies = cookies resp = request.get(endpoint) assert resp.status_code == int(HTTPStatus.OK) assert "id_type" in resp.text - # As a TU, we can modify other user's account types. + # As a PM, we can modify other user's account types. data = { "U": user2.Username, "E": user2.Email, @@ -1342,12 +1342,12 @@ def test_post_account_edit_other_user_suspend_as_tu(client: TestClient, pm_user: cookies = {"AURSID": pm_user.login(Request(), "testPassword")} assert cookies is not None # This is useless, we create the dict here ^ - # As a TU, we can see the Account for other users. + # As a PM, we can see the Account for other users. with client as request: request.cookies = cookies resp = request.get(endpoint) assert resp.status_code == int(HTTPStatus.OK) - # As a TU, we can modify other user's account types. + # As a PM, we can modify other user's account types. data = { "U": user.Username, "E": user.Email, @@ -1383,7 +1383,7 @@ def test_post_account_edit_other_user_type_as_pm_invalid_type( cookies = {"AURSID": pm_user.login(Request(), "testPassword")} endpoint = f"/account/{user2.Username}/edit" - # As a TU, we can modify other user's account types. + # As a PM, we can modify other user's account types. data = {"U": user2.Username, "E": user2.Email, "T": 0, "passwd": "testPassword"} with client as request: request.cookies = cookies @@ -1598,7 +1598,7 @@ def test_post_accounts_account_type(client: TestClient, user: User, pm_user: Use assert type.text.strip() == "User" - # Set our only user to a Trusted User. + # Set our only user to a Package Maintainer. with db.begin(): user.AccountType = ( query(AccountType).filter(AccountType.ID == PACKAGE_MAINTAINER_ID).first() @@ -2065,7 +2065,7 @@ def test_account_delete_self_unauthorized(client: TestClient, pm_user: User): resp = request.post(endpoint) assert resp.status_code == HTTPStatus.UNAUTHORIZED - # But a TU does have access + # But a PM does have access cookies = {"AURSID": pm_user.login(Request(), "testPassword")} with TestClient(app=app) as request: request.cookies = cookies diff --git a/test/test_notify.py b/test/test_notify.py index c54b814d..c096ca1d 100644 --- a/test/test_notify.py +++ b/test/test_notify.py @@ -567,7 +567,7 @@ ends in less than 48 hours. def test_notify_main(user: User): - """Test TU vote reminder through aurweb.notify.main().""" + """Test PM vote reminder through aurweb.notify.main().""" set_tu([user]) vote_id = 1 diff --git a/test/test_package_maintainer_routes.py b/test/test_package_maintainer_routes.py index ed490c49..afaa3cd0 100644 --- a/test/test_package_maintainer_routes.py +++ b/test/test_package_maintainer_routes.py @@ -96,9 +96,9 @@ def pm_user(): with db.begin(): pm_user = db.create( User, - Username="test_tu", - Email="test_tu@example.org", - RealName="Test TU", + Username="test_pm", + Email="test_pm@example.org", + RealName="Test PM", Passwd="testPassword", AccountType=pm_type, ) @@ -110,9 +110,9 @@ def pm_user2(): with db.begin(): pm_user2 = db.create( User, - Username="test_tu2", - Email="test_tu2@example.org", - RealName="Test TU 2", + Username="test_pm2", + Email="test_pm2@example.org", + RealName="Test PM 2", Passwd="testPassword", AccountTypeID=PACKAGE_MAINTAINER_ID, ) @@ -307,12 +307,12 @@ def test_pm_stats(client: TestClient, pm_user: User): stats = root.xpath('//table[@class="no-width"]')[0] rows = stats.xpath("./tbody/tr") - # We have one trusted user. + # We have one package maintainer. total = rows[0] label, count = total.xpath("./td") assert int(count.text.strip()) == 1 - # And we have one active TU. + # And we have one active PM. active = rows[1] label, count = active.xpath("./td") assert int(count.text.strip()) == 1 @@ -329,12 +329,12 @@ def test_pm_stats(client: TestClient, pm_user: User): stats = root.xpath('//table[@class="no-width"]')[0] rows = stats.xpath("./tbody/tr") - # We have one trusted user. + # We have one package maintainer. total = rows[0] label, count = total.xpath("./td") assert int(count.text.strip()) == 1 - # But we have no more active TUs. + # But we have no more active PMs. active = rows[1] label, count = active.xpath("./td") assert int(count.text.strip()) == 0 diff --git a/test/test_packages_routes.py b/test/test_packages_routes.py index fac0c9cd..9c038c14 100644 --- a/test/test_packages_routes.py +++ b/test/test_packages_routes.py @@ -120,9 +120,9 @@ def pm_user(): with db.begin(): pm_user = db.create( User, - Username="test_tu", + Username="test_pm", Email="test_tu@example.org", - RealName="Test TU", + RealName="Test PM", Passwd="testPassword", AccountType=pm_type, ) @@ -603,7 +603,7 @@ def test_package_authenticated_maintainer( for expected_text in expected: assert expected_text in resp.text - # make sure we don't have these. Only for TUs/Devs + # make sure we don't have these. Only for PMs/Devs not_expected = [ "1 pending request", "Delete Package", @@ -1632,7 +1632,7 @@ def test_packages_post_delete( expected = "You do not have permission to delete packages." assert errors[0].text.strip() == expected - # Now, let's switch over to making the requests as a TU. + # Now, let's switch over to making the requests as a PM. # However, this next request will be rejected due to supplying # an invalid package ID. pm_cookies = {"AURSID": pm_user.login(Request(), "testPassword")} diff --git a/test/test_pkgbase_routes.py b/test/test_pkgbase_routes.py index 6fab6200..b3bf705c 100644 --- a/test/test_pkgbase_routes.py +++ b/test/test_pkgbase_routes.py @@ -123,9 +123,9 @@ def pm_user(): with db.begin(): pm_user = db.create( User, - Username="test_tu", + Username="test_pm", Email="test_tu@example.org", - RealName="Test TU", + RealName="Test PM", Passwd="testPassword", AccountType=pm_type, ) @@ -1399,7 +1399,7 @@ def test_pkgbase_delete_with_request( client: TestClient, pm_user: User, pkgbase: PackageBase, pkgreq: PackageRequest ): # TODO: Test that a previously existing request gets Accepted when - # a TU deleted the package. + # a PM deleted the package. # Delete the package as `pm_user` via POST request. cookies = {"AURSID": pm_user.login(Request(), "testPassword")} diff --git a/test/test_requests.py b/test/test_requests.py index 14b27069..c118ce0b 100644 --- a/test/test_requests.py +++ b/test/test_requests.py @@ -919,7 +919,7 @@ def test_requests_with_package_name_filter( packages: list[Package], requests: list[PackageRequest], ): - # test as TU + # test as PM cookies = {"AURSID": pm_user.login(Request(), "testPassword")} with client as request: request.cookies = cookies @@ -934,7 +934,7 @@ def test_requests_with_package_name_filter( # We expect 11 requests for all packages containing "kg_1" assert len(rows) == 11 - # test as TU, no results + # test as PM, no results with client as request: request.cookies = cookies resp = request.get( diff --git a/test/test_user.py b/test/test_user.py index e494dbca..ac6be274 100644 --- a/test/test_user.py +++ b/test/test_user.py @@ -307,11 +307,11 @@ def test_can_edit_user( assert not user.can_edit_user(dev_user) assert not user.can_edit_user(pm_and_dev_user) - # Trusted User can edit. + # Package Maintainer can edit. assert pm_user.can_edit_user(user) assert pm_user.can_edit_user(pm_user) - # Trusted User cannot edit. + # Package Maintainer cannot edit. assert not pm_user.can_edit_user(dev_user) assert not pm_user.can_edit_user(pm_and_dev_user) @@ -323,7 +323,7 @@ def test_can_edit_user( # Developer cannot edit. assert not dev_user.can_edit_user(pm_and_dev_user) - # Trusted User & Developer can edit. + # Package Maintainer & Developer can edit. assert pm_and_dev_user.can_edit_user(user) assert pm_and_dev_user.can_edit_user(pm_user) assert pm_and_dev_user.can_edit_user(dev_user)