Skip to content

Commit 6691ac6

Browse files
committed
fix: allow admins to remove admin, show members without charter
- Remove admin button now visible to all admins, not just owners - Backend allows admins to revoke admin privileges from other admins - Members list renders on group page even when no charter exists - Hide signing status indicators when no charter is present
1 parent a576211 commit 6691ac6

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

platforms/group-charter-manager/api/src/controllers/GroupController.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,10 +379,7 @@ export class GroupController {
379379
const newAdmins = [...currentAdmins, targetUserId];
380380
await this.groupService.updateGroup(groupId, { admins: newAdmins } as any);
381381
} else if (role === "member") {
382-
// Remove admin - only owner can do this
383-
if (!isOwner) {
384-
return res.status(403).json({ error: "Only the owner can remove admin privileges" });
385-
}
382+
// Remove admin - admins and owners can do this
386383
if (targetUserId === group.owner) {
387384
return res.status(400).json({ error: "Cannot demote the owner" });
388385
}

platforms/group-charter-manager/client/src/app/charter/[id]/page.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,13 @@ export default function CharterDetail({
419419
)}
420420

421421
{/* Charter Signing Status */}
422-
{group.charter && (
423-
<CharterSigningStatus
424-
groupId={group.id}
425-
charterContent={group.charter}
426-
currentUserId={user?.id}
427-
currentUserIsAdmin={group.admins?.includes(user?.id || '') || false}
428-
currentUserIsOwner={group.owner === user?.id}
429-
/>
430-
)}
422+
<CharterSigningStatus
423+
groupId={group.id}
424+
charterContent={group.charter || ""}
425+
currentUserId={user?.id}
426+
currentUserIsAdmin={group.admins?.includes(user?.id || '') || false}
427+
currentUserIsOwner={group.owner === user?.id}
428+
/>
431429
</div>
432430
</div>
433431

platforms/group-charter-manager/client/src/components/charter-signing-status.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,22 @@ export function CharterSigningStatus({ groupId, charterContent, currentUserId, c
134134
className="flex items-center justify-between p-3 bg-gray-50 rounded-lg"
135135
>
136136
<div className="flex items-center gap-3">
137-
{participant.hasSigned ? (
138-
<CheckCircle className="h-5 w-5 text-green-600" />
139-
) : (
140-
<Circle className="h-5 w-5 text-gray-400" />
141-
)}
137+
{charterContent ? (
138+
participant.hasSigned ? (
139+
<CheckCircle className="h-5 w-5 text-green-600" />
140+
) : (
141+
<Circle className="h-5 w-5 text-gray-400" />
142+
)
143+
) : null}
142144
<div>
143145
<p className="font-medium text-sm">
144146
{participant.name || participant.ename || 'Unknown User'}
145147
</p>
146-
<p className="text-xs text-gray-500">
147-
{participant.hasSigned ? 'Signed' : 'Not signed yet'}
148-
</p>
148+
{charterContent && (
149+
<p className="text-xs text-gray-500">
150+
{participant.hasSigned ? 'Signed' : 'Not signed yet'}
151+
</p>
152+
)}
149153
</div>
150154
</div>
151155
<div className="flex items-center gap-2">
@@ -173,7 +177,7 @@ export function CharterSigningStatus({ groupId, charterContent, currentUserId, c
173177
Make Admin
174178
</DropdownMenuItem>
175179
)}
176-
{participant.isAdmin && !participant.isOwner && currentUserIsOwner && (
180+
{participant.isAdmin && !participant.isOwner && (
177181
<DropdownMenuItem onClick={() => handleRoleChange(participant.id, "member")}>
178182
<ShieldOff className="mr-2 h-4 w-4" />
179183
Remove Admin

0 commit comments

Comments
 (0)