v0.9.26 added a admin tools

This commit is contained in:
2026-03-15 16:36:01 -04:00
parent 53d665cc6f
commit 7bc0d26cdd
17 changed files with 872 additions and 96 deletions

View File

@@ -340,6 +340,7 @@ router.delete('/:id/leave', authMiddleware, (req, res) => {
const group = db.prepare('SELECT * FROM groups WHERE id = ?').get(req.params.id);
if (!group) return res.status(404).json({ error: 'Group not found' });
if (group.type === 'public') return res.status(400).json({ error: 'Cannot leave public groups' });
if (group.is_managed && req.user.role !== 'admin') return res.status(403).json({ error: 'This group is managed by an administrator. Contact an admin to be removed.' });
const userId = req.user.id;
const leaverName = req.user.display_name || req.user.name;