♻️ Handle self-hosting environment with updated authentication (#918)

This commit is contained in:
Luke Vella 2023-10-30 10:23:43 +00:00 committed by GitHub
parent 221ae62d8e
commit 3e90c302d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 133 additions and 222 deletions

View file

@ -16,7 +16,6 @@ import {
router,
} from "../trpc";
import { comments } from "./polls/comments";
import { demo } from "./polls/demo";
import { options } from "./polls/options";
import { participants } from "./polls/participants";
@ -42,7 +41,6 @@ const getPollIdFromAdminUrlId = async (urlId: string) => {
};
export const polls = router({
demo,
participants,
comments,
options,
@ -390,11 +388,12 @@ export const polls = router({
message: "Poll not found",
});
}
const inviteLink = ctx.shortUrl(`/invite/${res.id}`);
if (ctx.user.id === res.userId || res.adminUrlId === input.adminToken) {
return res;
return { ...res, inviteLink };
} else {
return { ...res, adminUrlId: "" };
return { ...res, adminUrlId: "", inviteLink };
}
}),
transfer: possiblyPublicProcedure