Self-Hosting Update (#842)

This commit is contained in:
Luke Vella 2023-09-11 15:34:55 +01:00 committed by GitHub
parent 3e616d1e41
commit 7a5f9ae474
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 945 additions and 781 deletions

View file

@ -9,7 +9,6 @@ import utc from "dayjs/plugin/utc";
import * as ics from "ics";
import { z } from "zod";
import { getSubscriptionStatus } from "../../utils/auth";
import { getTimeZoneAbbreviation } from "../../utils/date";
import { nanoid } from "../../utils/nanoid";
import {
@ -74,8 +73,6 @@ export const polls = router({
const participantUrlId = nanoid();
const pollId = nanoid();
const { active: isPro } = await getSubscriptionStatus(ctx.user.id);
const poll = await prisma.poll.create({
select: {
adminUrlId: true,
@ -117,13 +114,9 @@ export const polls = router({
})),
},
},
...(isPro
? {
hideParticipants: input.hideParticipants,
disableComments: input.disableComments,
hideScores: input.hideScores,
}
: undefined),
hideParticipants: input.hideParticipants,
disableComments: input.disableComments,
hideScores: input.hideScores,
},
});
@ -171,11 +164,9 @@ export const polls = router({
hideScores: z.boolean().optional(),
}),
)
.mutation(async ({ ctx, input }) => {
.mutation(async ({ input }) => {
const pollId = await getPollIdFromAdminUrlId(input.urlId);
const { active: isPro } = await getSubscriptionStatus(ctx.user.id);
if (input.optionsToDelete && input.optionsToDelete.length > 0) {
await prisma.option.deleteMany({
where: {
@ -218,13 +209,9 @@ export const polls = router({
description: input.description,
timeZone: input.timeZone,
closed: input.closed,
...(isPro
? {
hideScores: input.hideScores,
hideParticipants: input.hideParticipants,
disableComments: input.disableComments,
}
: undefined),
hideScores: input.hideScores,
hideParticipants: input.hideParticipants,
disableComments: input.disableComments,
},
});
}),