Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
organizationPermissions,
isBillingContact: row.original.userEmail === billingContact,
onAttemptRemoveBillingContactUser,
pendingAcceptance: Boolean(row.original.invitedBy),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending invite check fails when invitedBy is empty

The pendingAcceptance check uses Boolean(row.original.invitedBy) which fails when invitedBy is an empty string. The backend returns an empty string for invites created without a known inviter (e.g., by a service account) since safeStr() converts database NULL to "". This causes Boolean("") to be false, incorrectly enabling the "Convert to member" action for pending invites. The filter logic elsewhere uses "invitedBy" in user (property existence check) which correctly identifies all invites regardless of the invitedBy value.

Additional Locations (1)

Fix in Cursor Fix in Web

onConvertToMember: () => onConvertToMember(row.original),
}),
meta: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import * as DropdownMenu from "@rilldata/web-common/components/dropdown-menu";
import ThreeDot from "@rilldata/web-common/components/icons/ThreeDot.svelte";
import { OrgUserRoles } from "@rilldata/web-common/features/users/roles.ts";
import { Trash2Icon } from "lucide-svelte";
import RemoveUserFromOrgConfirmDialog from "@rilldata/web-admin/features/organizations/user-management/dialogs/RemoveUserFromOrgConfirmDialog.svelte";
import {
createAdminServiceRemoveOrganizationMemberUser,
Expand All @@ -26,12 +25,14 @@
// This also avoids rendering the modal per row.
export let onAttemptRemoveBillingContactUser: () => void;
export let onConvertToMember: () => void;
export let pendingAcceptance = false;

let isDropdownOpen = false;
let isRemoveConfirmOpen = false;

$: organization = $page.params.organization;
$: isGuest = role === OrgUserRoles.Guest;
$: canConvertToMember = isGuest && !pendingAcceptance;
$: canManageUser =
// TODO: backend doesnt restrict removing oneself, revisit this UI check.
!isCurrentUser && canManageOrgUser(organizationPermissions, role);
Expand Down Expand Up @@ -82,7 +83,7 @@
</IconButton>
</DropdownMenu.Trigger>
<DropdownMenu.Content align="start">
{#if role === OrgUserRoles.Guest}
{#if canConvertToMember}
<DropdownMenu.Item
class="font-normal flex items-center"
on:click={onConvertToMember}
Expand All @@ -95,8 +96,7 @@
type="destructive"
on:click={onRemoveClick}
>
<Trash2Icon size="12px" />
<span class="ml-2">Remove</span>
Remove
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
Expand Down
Loading