docs: add block/mute user relations, emoji-sync CLI, and uid indexes
DevPlace CI / test (push) Failing after 2m7s
DevPlace CI / test (push) Failing after 2m7s
- 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:
@@ -5,7 +5,7 @@ from datetime import datetime, timezone
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from devplacepy.database import get_table, internal_gateway_key, purge, refresh_snapshot
|
||||
from devplacepy.database import get_table, purge, refresh_snapshot
|
||||
from devplacepy.main import app
|
||||
from devplacepy.services.manager import service_manager
|
||||
from devplacepy.utils import generate_uid
|
||||
@@ -55,4 +55,32 @@ def client():
|
||||
|
||||
@pytest.fixture
|
||||
def auth(client):
|
||||
return {"X-API-KEY": internal_gateway_key()}
|
||||
from devplacepy.database import get_primary_admin_uid, invalidate_admins_cache
|
||||
from devplacepy.utils import clear_user_cache
|
||||
|
||||
users = get_table("users")
|
||||
uid = get_primary_admin_uid()
|
||||
if uid is None:
|
||||
uid = generate_uid()
|
||||
users.insert(
|
||||
{
|
||||
"uid": uid,
|
||||
"username": f"dbapi_admin_{uid[:8]}",
|
||||
"email": f"{uid[:8]}@dbapi.test",
|
||||
"role": "Admin",
|
||||
"api_key": f"dbapikey_{uid}",
|
||||
"xp": 0,
|
||||
"level": 1,
|
||||
"created_at": datetime.now(timezone.utc).isoformat(),
|
||||
}
|
||||
)
|
||||
invalidate_admins_cache()
|
||||
refresh_snapshot()
|
||||
admin = users.find_one(uid=uid)
|
||||
key = admin.get("api_key")
|
||||
if not key:
|
||||
key = f"dbapikey_{uid}"
|
||||
users.update({"uid": uid, "api_key": key}, ["uid"])
|
||||
clear_user_cache(uid)
|
||||
refresh_snapshot()
|
||||
return {"X-API-KEY": key}
|
||||
|
||||
Reference in New Issue
Block a user