summary refs log tree commit diff
path: root/src/api/routes/users
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-11-26 17:20:57 +0100
committerRory& <root@rory.gay>2025-11-26 17:20:57 +0100
commitce3a46ed2c6fd1d45918275e8f39ff3734089ef0 (patch)
tree0f42194aadea89d29677f1b6ae721ab85210b1b8 /src/api/routes/users
parentSwap around toJSON and withSignedAttachments (oops) (diff)
downloadserver-ts-ce3a46ed2c6fd1d45918275e8f39ff3734089ef0.tar.xz
Maybe?
Diffstat (limited to 'src/api/routes/users')
-rw-r--r--src/api/routes/users/@me/mentions.ts24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/api/routes/users/@me/mentions.ts b/src/api/routes/users/@me/mentions.ts

index 0bee6bb0..cd3bb684 100644 --- a/src/api/routes/users/@me/mentions.ts +++ b/src/api/routes/users/@me/mentions.ts
@@ -17,7 +17,7 @@ */ import { route } from "@spacebar/api"; -import { Snowflake, User, Message, Member, Channel, Permissions, timePromise, NewUrlUserSignatureData, Stopwatch } from "@spacebar/util"; +import { Snowflake, User, Message, Member, Channel, Permissions, timePromise, NewUrlUserSignatureData, Stopwatch, Attachment } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { In } from "typeorm"; @@ -182,14 +182,20 @@ router.get( "referenced_message.attachments", ], }) - ).map((m) => - m.withSignedAttachments( - new NewUrlUserSignatureData({ - ip: req.ip, - userAgent: req.headers["user-agent"] as string, - }), - ).toJSON(), - ); + ).map((m) => { + return { + ...m.toJSON(), + attachments: m.attachments?.map((attachment: Attachment) => + Attachment.prototype.signUrls.call( + attachment, + new NewUrlUserSignatureData({ + ip: req.ip, + userAgent: req.headers["user-agent"] as string, + }), + ), + ), + }; + }); console.log(`[Inbox/mentions] User ${user.id} fetched full message data for ${finalMessages.length} messages in ${sw.elapsed().totalMilliseconds}ms`);