Download spectrum/api/queries/message/reactions.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 525 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/queries/message/reactions.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/queries/message/reactions.js
-
curl -L -o reactions.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/queries/message/reactions.js
525 Bytes
| // @flow | |
| import type { DBMessage } from 'shared/types'; | |
| import type { GraphQLContext } from '../../'; | |
| export default ({ id }: DBMessage, _: any, { user, loaders }: GraphQLContext) => | |
| loaders.messageReaction.load(id).then(result => { | |
| if (!result) | |
| return { | |
| count: 0, | |
| hasReacted: false, | |
| }; | |
| const reactions = result.reduction; | |
| return { | |
| count: reactions.length, | |
| hasReacted: user | |
| ? reactions.some(reaction => reaction.userId === user.id) | |
| : false, | |
| }; | |
| }); | |