forked from retoor/devplacepy
docs: add block/mute user relations, emoji-sync CLI, and uid indexes
- Add `/block`, `/mute` endpoints with block/unblock and mute/unmute functionality in `routers/relations.py`, hiding blocked users' content everywhere except their own profile while muting only suppresses notifications - Introduce `devplace emoji-sync` CLI command to regenerate `static/js/emoji-shortcodes.js` from the emoji library, documented in `CLAUDE.md` and wired in `cli.py` - Create `get_blocked_uids()` database helper and apply it in `content.py` `load_detail()` to filter blocked users' posts from detail views - Implement `_uid_index()` and `_drop_index()` helpers in `database.py` for unique uid indexes across tables, with `user_relations` added to `SOFT_DELETE_TABLES` - Document new routes in `AGENTS.md` and `README.md`, including emoji shortcodes rendering behavior distinct from the emoji picker
This commit is contained in:
@@ -4,7 +4,12 @@ import time
|
||||
import requests
|
||||
from tests.conftest import BASE_URL, login_user
|
||||
from devplacepy import config
|
||||
from devplacepy.database import get_table, get_primary_admin_uid, refresh_snapshot
|
||||
from devplacepy.database import (
|
||||
get_table,
|
||||
get_primary_admin_uid,
|
||||
invalidate_admins_cache,
|
||||
refresh_snapshot,
|
||||
)
|
||||
from devplacepy.services.backup import store
|
||||
from devplacepy.utils import clear_user_cache
|
||||
|
||||
@@ -29,6 +34,7 @@ def _make_admin():
|
||||
row = get_table("users").find_one(username=name)
|
||||
get_table("users").update({"uid": row["uid"], "role": "Admin"}, ["uid"])
|
||||
clear_user_cache(row["uid"])
|
||||
invalidate_admins_cache()
|
||||
return {"email": f"{name}@t.dev", "password": password, "uid": row["uid"]}
|
||||
|
||||
|
||||
@@ -84,15 +90,20 @@ def test_download_enabled_for_primary_admin(page, app_server):
|
||||
for uid in others:
|
||||
get_table("users").update({"uid": uid, "role": "Member"}, ["uid"])
|
||||
clear_user_cache(uid)
|
||||
invalidate_admins_cache()
|
||||
try:
|
||||
assert get_primary_admin_uid() == admin["uid"]
|
||||
backup_uid = _seed_done_backup(admin["uid"])
|
||||
login_user(page, admin)
|
||||
page.goto(f"{BASE_URL}/admin/backups", wait_until="domcontentloaded")
|
||||
row = _row(page, backup_uid)
|
||||
row.wait_for(state="visible", timeout=15000)
|
||||
|
||||
link = row.locator("a.admin-btn:has-text('Download')")
|
||||
link = None
|
||||
for _ in range(20):
|
||||
page.goto(f"{BASE_URL}/admin/backups", wait_until="domcontentloaded")
|
||||
row = _row(page, backup_uid)
|
||||
row.wait_for(state="visible", timeout=15000)
|
||||
link = row.locator("a.admin-btn:has-text('Download')")
|
||||
if link.count() > 0:
|
||||
break
|
||||
time.sleep(0.3)
|
||||
link.wait_for(state="visible")
|
||||
assert link.get_attribute("href") == f"/admin/backups/{backup_uid}/download"
|
||||
assert row.locator("button.admin-btn[title='Not available']").count() == 0
|
||||
|
||||
Reference in New Issue
Block a user