Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔒 Hide "create your own poll" CTA from the poll organizer (#2742)

Luke Vellab310a328cb57
diff --git a/apps/web/src/features/poll/components/new-participant-modal.tsx b/apps/web/src/features/poll/components/new-participant-modal.tsx
index ac778ddcc..ff12d95d5 100644
--- a/apps/web/src/features/poll/components/new-participant-modal.tsx
+++ b/apps/web/src/features/poll/components/new-participant-modal.tsx
@@ -102,6 +102,7 @@ export const NewParticipantForm = (props: NewParticipantModalProps) => {
const { timeZone } = useDateTimeConfig();
const { user, createGuestIfNeeded } = useUser();
const isLoggedIn = user && !user.isGuest;
+ const isOrganizer = user?.id === poll.userId;
const form = useForm({
resolver: zodResolver(schema),
defaultValues: {
@@ -147,37 +148,39 @@ export const NewParticipantForm = (props: NewParticipantModalProps) => {
defaults="Back to poll"
/>
</Button>
- <div className="flex flex-col items-center text-center">
- <p className="text-muted-foreground text-sm">
- <Trans
- i18nKey="newParticipantDialogCreatePollPrompt"
- defaults="Need to schedule something yourself?"
- />
- </p>
- <Link
- href="/new"
- className={buttonVariants({ variant: "link" })}
- onClick={() => {
- posthog?.capture(
- "new_participant_dialog:create_poll_button_click",
- {
- pollId: poll.id,
- spaceId: poll.spaceId,
- tier: poll.space?.tier,
- $groups: {
- poll: poll.id,
- ...(poll.spaceId ? { space: poll.spaceId } : {}),
+ {!isOrganizer ? (
+ <div className="flex flex-col items-center text-center">
+ <p className="text-muted-foreground text-sm">
+ <Trans
+ i18nKey="newParticipantDialogCreatePollPrompt"
+ defaults="Need to schedule something yourself?"
+ />
+ </p>
+ <Link
+ href="/new"
+ className={buttonVariants({ variant: "link" })}
+ onClick={() => {
+ posthog?.capture(
+ "new_participant_dialog:create_poll_button_click",
+ {
+ pollId: poll.id,
+ spaceId: poll.spaceId,
+ tier: poll.space?.tier,
+ $groups: {
+ poll: poll.id,
+ ...(poll.spaceId ? { space: poll.spaceId } : {}),
+ },
},
- },
- );
- }}
- >
- <Trans
- i18nKey="newParticipantDialogCreatePoll"
- defaults="Create your own poll"
- />
- </Link>
- </div>
+ );
+ }}
+ >
+ <Trans
+ i18nKey="newParticipantDialogCreatePoll"
+ defaults="Create your own poll"
+ />
+ </Link>
+ </div>
+ ) : null}
</>
);
}
diff --git a/apps/web/tests/invite-page.ts b/apps/web/tests/invite-page.ts
index 75c0ebf8c..2a2ec4475 100644
--- a/apps/web/tests/invite-page.ts
+++ b/apps/web/tests/invite-page.ts
@@ -19,9 +19,6 @@ export class InvitePage {
await page.click("text='Submit'");
await expect(page.getByText("Your response has been saved")).toBeVisible();
- await expect(
- page.getByRole("link", { name: "Create your own poll" }),
- ).toHaveAttribute("href", "/new");
await page.click("button >> text='Back to poll'");
}
}