mirror of
https://github.com/spacebarchat/server.git
synced 2026-08-24 13:49:54 +00:00
feat: set me_voted for poll messages
This commit is contained in:
@@ -46,6 +46,7 @@ import {
|
||||
MessageCreateCloudAttachment,
|
||||
MessageCreateSchema,
|
||||
PartialUser,
|
||||
PollAnswerCount,
|
||||
PublicMessage,
|
||||
Reaction,
|
||||
ReadStateType,
|
||||
@@ -213,6 +214,13 @@ router.get(
|
||||
return att;
|
||||
}) ?? [];
|
||||
|
||||
(x.poll?.results?.answer_counts as (PollAnswerCount & { voters?: string[] })[]).map((answer) => {
|
||||
answer.me_voted = answer.voters!.includes(req.user_id);
|
||||
delete answer.voters;
|
||||
|
||||
return answer;
|
||||
});
|
||||
|
||||
/**
|
||||
Some clients ( discord.js ) only check if a property exists within the response,
|
||||
which causes errors when, say, the `application` property is `null`.
|
||||
|
||||
Reference in New Issue
Block a user