diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-08-11 12:40:13 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-08-11 12:40:13 +0200 |
| commit | edde9e441fb6b84e9d56215d6e2a8d9338b8f962 (patch) | |
| tree | be09d4cc1a64e9ccc488ca9fcc1e23b6a133a8f5 /packages/meshbay-hub/src/meshbay_hub/api/admin.py | |
| parent | ccb2b85051b88578c7d739ff46385e50a65591a6 (diff) | |
| download | meshbay-edde9e441fb6b84e9d56215d6e2a8d9338b8f962.tar.gz | |
feat(hub): Phase 10.5–10.8, 10.10 — notifications, settings, search, version
- 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 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/admin.py')
| -rw-r--r-- | packages/meshbay-hub/src/meshbay_hub/api/admin.py | 16 |
1 files changed, 16 insertions, 0 deletions
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, |