From 8e7b5a3d93d9c0779605532b3e9ee1ceadef2c9e Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Tue, 12 Sep 2023 12:08:52 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20broken=20invite=20link?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #848 --- apps/web/src/components/invite-dialog.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/invite-dialog.tsx b/apps/web/src/components/invite-dialog.tsx index 789d3444642..e3eb9d3ed86 100644 --- a/apps/web/src/components/invite-dialog.tsx +++ b/apps/web/src/components/invite-dialog.tsx @@ -16,6 +16,7 @@ import { useCopyToClipboard } from "react-use"; import { useParticipants } from "@/components/participants-provider"; import { Trans } from "@/components/trans"; import { usePoll } from "@/contexts/poll"; +import { isSelfHosted } from "@/utils/constants"; export const InviteDialog = () => { const { participants } = useParticipants(); @@ -30,7 +31,10 @@ export const InviteDialog = () => { } }, [state]); - const inviteLink = shortUrl(`/invite/${poll?.id}`); + const inviteLink = isSelfHosted + ? window.location.origin + `/invite/${poll?.id}` + : shortUrl(`/invite/${poll?.id}`); + const [didCopy, setDidCopy] = React.useState(false); return (