bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/user-reaction/service.js
Max Franke d28b93a586 feat(reactions): add user reaction
add user-reaction collection
add emoji picker for user reaction in the user list
add options to enable/disable user-reaction
add a way to pass style to emoji-picker component
2023-04-27 11:54:11 -03:00

44 lines
887 B
JavaScript

import UserReaction from '/imports/api/user-reaction';
import Auth from '/imports/ui/services/auth';
import { makeCall } from '/imports/ui/services/api';
import { getFromMeetingSettingsAsBoolean } from '/imports/ui/services/meeting-settings';
const ENABLED = Meteor.settings.public.userReaction.enabled;
const isEnabled = () => getFromMeetingSettingsAsBoolean('enable-user-reaction', ENABLED);
const setUserReaction = (reaction) => {
if (isEnabled()) {
makeCall('setUserReaction', reaction);
}
};
const getUserReaction = (userId) => {
const reaction = UserReaction.findOne(
{
meetingId: Auth.meetingID,
userId,
},
{
fields:
{
reaction: 1,
},
},
);
if (!reaction) {
return {
reaction: 'none',
};
}
return reaction;
};
export default {
getUserReaction,
setUserReaction,
isEnabled,
};