Skip to content

Commit

Permalink
Super owner clause for leaving
Browse files Browse the repository at this point in the history
  • Loading branch information
NotNite committed Nov 28, 2023
1 parent 108a265 commit cd8394e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/routes/crews/Crew.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ function LeaveCrewButton({
// This is implemented serverside as well
const canLeaveMemberClause = me != null && crew.members.length > 1;
const canLeaveOwnersClause = me != null && (owners.length > 1 || !me.owner);
const canLeave = canLeaveMemberClause && canLeaveOwnersClause;
const canLeaveSuperOwnerClause = me != null && crew.super_owner != me.id;
const canLeave =
canLeaveMemberClause && canLeaveOwnersClause && canLeaveSuperOwnerClause;

let tooltip = "";
if (!canLeaveMemberClause) {
Expand All @@ -135,6 +137,10 @@ function LeaveCrewButton({
tooltip = "You're the only owner of this crew.";
}

if (!canLeaveSuperOwnerClause) {
tooltip = "You're the creator of this crew.";
}

return (
<div
className="tooltipHack"
Expand Down

0 comments on commit cd8394e

Please sign in to comment.