From 491e80f7dd557ba43f633ed7117924936e62cc67 Mon Sep 17 00:00:00 2001 From: rasmus Date: Sat, 31 May 2025 02:25:04 +0300 Subject: [PATCH] rename visibilities once again to match with vision in https://wiki.k-space.ee/en/about/inventory Upper case makes more sense, as it is displayed straight to user. Renamed on database-side as well. --- README.md | 2 +- inventory-app/inventory.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3609748..8f69081 100644 --- a/README.md +++ b/README.md @@ -7,5 +7,5 @@ |Group|Description| |-----|-----------| |k-space:inventory:audit|Update last time item information confirmed to be accurate| -|k-space:inventory:edit|Edit all items that are not keys. Browse items with secret visibility.| +|k-space:inventory:edit|Edit all non-key items. Browse items with Protected visibility.| |k-space:inventory:keys|Edit keys| diff --git a/inventory-app/inventory.py b/inventory-app/inventory.py index 315ebee..02bcdee 100644 --- a/inventory-app/inventory.py +++ b/inventory-app/inventory.py @@ -42,7 +42,7 @@ def view_inventory_view(item_id): return abort(404) item_user = item.get("inventory", {}).get("user", {}).get("username", None) if not user: - if item["inventory"].get("visibility") not in ["public", "unlisted"]: + if item["inventory"].get("visibility") not in ["Featured", "Normal"]: return do_login() template = "inventory_view_public.html" redirect_url = urllib.parse.quote_plus(request.full_path) @@ -129,7 +129,7 @@ class InventoryForm(Form): owner = FormField(MemberForm, label="Owner") user = FormField(MemberForm, label="Current User") usable = BooleanField("Usable") - visibility = SelectField("Visibility", choices=['public', 'unlisted', 'secret', 'archived'], default='unlisted') + visibility = SelectField("Visibility", choices=['Normal', 'Featured', 'Protected', 'Archived'], default='Normal') class HardwareForm(Form): serial = StringField("Serial Number") @@ -435,7 +435,7 @@ def view_inventory(slug=None): login_user = read_user() if not login_user: - q.update({"inventory.visibility": {"$eq": "public"}}) + q.update({"inventory.visibility": {"$eq": "Featured"}}) template = "inventory_public.html" public_view = True else: @@ -443,9 +443,9 @@ def view_inventory(slug=None): fields.append(("inventory.user.username", "User", str)) can_audit = "k-space:inventory:audit" in login_user.get("groups", []) can_edit_all = "k-space:inventory:edit" in login_user.get("groups", []) - v = ["public", "unlisted"] + v = ["Featured", "Normal"] if can_edit_all: - v.append("secret") + v.append("Protected") q.update({ "$or": [ {"inventory.visibility": {"$in": v}},