mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 18:26:34 +02:00
Revert "🔒️ Rate limit comments (#1363)"
This reverts commit 50e4084b76
.
This commit is contained in:
parent
c0bc3139a5
commit
941bd811ba
2 changed files with 8 additions and 16 deletions
|
@ -15,7 +15,6 @@ import {
|
||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@rallly/ui/dropdown-menu";
|
} from "@rallly/ui/dropdown-menu";
|
||||||
import { useToast } from "@rallly/ui/hooks/use-toast";
|
|
||||||
import { Icon } from "@rallly/ui/icon";
|
import { Icon } from "@rallly/ui/icon";
|
||||||
import { Input } from "@rallly/ui/input";
|
import { Input } from "@rallly/ui/input";
|
||||||
import { Textarea } from "@rallly/ui/textarea";
|
import { Textarea } from "@rallly/ui/textarea";
|
||||||
|
@ -78,6 +77,13 @@ function NewCommentForm({
|
||||||
|
|
||||||
const queryClient = trpc.useUtils();
|
const queryClient = trpc.useUtils();
|
||||||
|
|
||||||
|
const addComment = trpc.polls.comments.add.useMutation({
|
||||||
|
onSuccess: () => {
|
||||||
|
queryClient.polls.comments.invalidate();
|
||||||
|
posthog?.capture("created comment");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const session = useUser();
|
const session = useUser();
|
||||||
|
|
||||||
const { register, reset, control, handleSubmit, formState } =
|
const { register, reset, control, handleSubmit, formState } =
|
||||||
|
@ -87,20 +93,7 @@ function NewCommentForm({
|
||||||
content: "",
|
content: "",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const { toast } = useToast();
|
|
||||||
|
|
||||||
const addComment = trpc.polls.comments.add.useMutation({
|
|
||||||
onSuccess: () => {
|
|
||||||
queryClient.polls.comments.invalidate();
|
|
||||||
posthog?.capture("created comment");
|
|
||||||
},
|
|
||||||
onError: (error) => {
|
|
||||||
toast({
|
|
||||||
title: "Error",
|
|
||||||
description: error.message,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
});
|
|
||||||
return (
|
return (
|
||||||
<form
|
<form
|
||||||
className="w-full space-y-2.5"
|
className="w-full space-y-2.5"
|
||||||
|
|
|
@ -5,12 +5,11 @@ import { absoluteUrl } from "@/utils/absolute-url";
|
||||||
import { getEmailClient } from "@/utils/emails";
|
import { getEmailClient } from "@/utils/emails";
|
||||||
import { createToken } from "@/utils/session";
|
import { createToken } from "@/utils/session";
|
||||||
|
|
||||||
import { publicProcedure, rateLimitMiddleware, router } from "../../trpc";
|
import { publicProcedure, router } from "../../trpc";
|
||||||
import { DisableNotificationsPayload } from "../../types";
|
import { DisableNotificationsPayload } from "../../types";
|
||||||
|
|
||||||
export const comments = router({
|
export const comments = router({
|
||||||
list: publicProcedure
|
list: publicProcedure
|
||||||
.use(rateLimitMiddleware)
|
|
||||||
.input(
|
.input(
|
||||||
z.object({
|
z.object({
|
||||||
pollId: z.string(),
|
pollId: z.string(),
|
||||||
|
|
Loading…
Add table
Reference in a new issue