Spaces:
Build error
Build error
Commit
•
09edaa6
1
Parent(s):
df5aa22
🥅 More helpful share error message (#148)
Browse files
src/routes/conversation/[id]/+page.server.ts
CHANGED
@@ -11,7 +11,19 @@ export const load: PageServerLoad = async (event) => {
|
|
11 |
});
|
12 |
|
13 |
if (!conversation) {
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
}
|
16 |
|
17 |
return {
|
|
|
11 |
});
|
12 |
|
13 |
if (!conversation) {
|
14 |
+
const conversationExists =
|
15 |
+
(await collections.conversations.countDocuments({
|
16 |
+
_id: new ObjectId(event.params.id),
|
17 |
+
})) !== 0;
|
18 |
+
|
19 |
+
if (conversationExists) {
|
20 |
+
throw error(
|
21 |
+
403,
|
22 |
+
"You don't have access to this conversation. If someone gave you this link, ask them to use the 'share' feature instead."
|
23 |
+
);
|
24 |
+
}
|
25 |
+
|
26 |
+
throw error(404, "Conversation not found.");
|
27 |
}
|
28 |
|
29 |
return {
|