housekeep: TU rename - Comments

Changes to comments, function descriptions, etc.

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2023-09-10 10:01:21 +02:00
parent 61f1e5b399
commit 87f6791ea8
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
15 changed files with 48 additions and 53 deletions

View file

@ -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;

View file

@ -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)!

View file

@ -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

View file

@ -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)
------------------------

View file

@ -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.

View file

@ -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

View file

@ -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;

View file

@ -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. #}
<a href="/pkgbase/{{ result.PackageBaseName }}/{{ action }}?{{ temp_q | urlencode }}">
{{ "Accept" | tr }}
</a>

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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")}

View file

@ -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")}

View file

@ -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(

View file

@ -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)