move rate limit event to top
Browse files
src/routes/conversation/[id]/+server.ts
CHANGED
@@ -38,6 +38,12 @@ export async function POST({ request, fetch, locals, params, getClientAddress })
|
|
38 |
throw error(404, "Conversation not found");
|
39 |
}
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
if (
|
42 |
!locals.user?._id &&
|
43 |
requiresUser &&
|
@@ -184,12 +190,6 @@ export async function POST({ request, fetch, locals, params, getClientAddress })
|
|
184 |
updatedAt: new Date(),
|
185 |
});
|
186 |
|
187 |
-
await collections.messageEvents.insertOne({
|
188 |
-
userId: userId,
|
189 |
-
createdAt: new Date(),
|
190 |
-
ip: getClientAddress(),
|
191 |
-
});
|
192 |
-
|
193 |
await collections.conversations.updateOne(
|
194 |
{
|
195 |
_id: convId,
|
|
|
38 |
throw error(404, "Conversation not found");
|
39 |
}
|
40 |
|
41 |
+
await collections.messageEvents.insertOne({
|
42 |
+
userId: userId,
|
43 |
+
createdAt: new Date(),
|
44 |
+
ip: getClientAddress(),
|
45 |
+
});
|
46 |
+
|
47 |
if (
|
48 |
!locals.user?._id &&
|
49 |
requiresUser &&
|
|
|
190 |
updatedAt: new Date(),
|
191 |
});
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
await collections.conversations.updateOne(
|
194 |
{
|
195 |
_id: convId,
|