d28b93a586
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
44 lines
887 B
JavaScript
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,
|
|
};
|