From edde9e441fb6b84e9d56215d6e2a8d9338b8f962 Mon Sep 17 00:00:00 2001 From: Christophe Besson Date: Tue, 11 Aug 2026 12:40:13 +0200 Subject: feat(hub): Phase 10.5–10.8, 10.10 — notifications, settings, search, version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 10.5: Notification model + CRUD API (list, mark read, mark all read) Triggered on: group invite, role change, suspend/unsuspend - 10.6: SettingsPage shows role, per-group notification mute (localStorage) - 10.7: GET /v1/groups?q= search filter (ilike on name) - 10.8: NotificationFeed on home page + bell with unread badge in navbar - 10.10: GET /v1/hub/version endpoint for client update checks - 8 new tests (test_notifications.py), 155 total Co-Authored-By: Claude Opus 4.6 --- packages/meshbay-hub/src/meshbay_hub/api/admin.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'packages/meshbay-hub/src/meshbay_hub/api/admin.py') diff --git a/packages/meshbay-hub/src/meshbay_hub/api/admin.py b/packages/meshbay-hub/src/meshbay_hub/api/admin.py index c3fa8c2..88e231a 100644 --- a/packages/meshbay-hub/src/meshbay_hub/api/admin.py +++ b/packages/meshbay-hub/src/meshbay_hub/api/admin.py @@ -134,11 +134,17 @@ async def admin_patch_user( if user.id == current_user.id: raise HTTPException(status_code=400, detail="Cannot modify your own account") + from meshbay_hub.api.notifications import create_notification + if body.role is not None: if body.role not in ("user", "moderator", "admin"): raise HTTPException(status_code=422, detail="role must be user, moderator, or admin") user.role = body.role log.info("User %s role changed to %s by %s", user.username, body.role, current_user.username) + await create_notification( + db, user.id, "role_change", + f"Your role has been changed to {body.role}", + ) if body.status is not None: if body.status not in ("active", "suspended", "revoked"): @@ -146,6 +152,16 @@ async def admin_patch_user( user.status = body.status log.info("User %s status changed to %s by %s", user.username, body.status, current_user.username) + if body.status == "suspended": + await create_notification( + db, user.id, "account_suspended", + "Your account has been suspended", + ) + elif body.status == "active": + await create_notification( + db, user.id, "account_restored", + "Your account has been restored", + ) db.add(IPLog( user_id=current_user.id, -- cgit v1.2.3