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:
+9
-1
@@ -1,6 +1,10 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from devplacepy.database import get_table, get_primary_admin_uid
|
||||
from devplacepy.database import (
|
||||
get_table,
|
||||
get_primary_admin_uid,
|
||||
invalidate_admins_cache,
|
||||
)
|
||||
from devplacepy.utils import (
|
||||
award_badge,
|
||||
award_xp,
|
||||
@@ -168,6 +172,7 @@ def _seed_user_at(role, created_at):
|
||||
"created_at": created_at.isoformat(),
|
||||
}
|
||||
)
|
||||
invalidate_admins_cache()
|
||||
return get_table("users").find_one(uid=uid)
|
||||
|
||||
|
||||
@@ -175,12 +180,14 @@ def _demote_existing_admins():
|
||||
existing = [r["uid"] for r in get_table("users").find(role="Admin")]
|
||||
for uid in existing:
|
||||
get_table("users").update({"uid": uid, "role": "Member"}, ["uid"])
|
||||
invalidate_admins_cache()
|
||||
return existing
|
||||
|
||||
|
||||
def _restore_admins(uids):
|
||||
for uid in uids:
|
||||
get_table("users").update({"uid": uid, "role": "Admin"}, ["uid"])
|
||||
invalidate_admins_cache()
|
||||
|
||||
|
||||
def _purge(*rows):
|
||||
@@ -219,6 +226,7 @@ def test_primary_admin_reassigns_when_founder_demoted(local_db):
|
||||
get_table("users").update(
|
||||
{"uid": admin_first["uid"], "role": "Member"}, ["uid"]
|
||||
)
|
||||
invalidate_admins_cache()
|
||||
assert get_primary_admin_uid() == admin_second["uid"]
|
||||
assert (
|
||||
is_primary_admin(get_table("users").find_one(uid=admin_second["uid"]))
|
||||
|
||||
Reference in New Issue
Block a user