2016-09-22 02:03:18 +08:00
|
|
|
import Auth from '/imports/ui/services/auth/index.js';
|
|
|
|
import Users from '/imports/api/users';
|
2017-04-26 21:47:44 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api/index.js';
|
2016-09-22 02:03:18 +08:00
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const getEmojiData = () => {
|
2016-09-22 02:03:18 +08:00
|
|
|
// Get userId and meetingId
|
2017-03-17 22:23:00 +08:00
|
|
|
const credentials = Auth.credentials;
|
2016-09-27 04:29:44 +08:00
|
|
|
const { requesterUserId: userId, meetingId } = credentials;
|
2016-09-22 02:03:18 +08:00
|
|
|
|
|
|
|
// Find the Emoji Status of this specific meeting and userid
|
|
|
|
const userEmojiStatus = Users.findOne({
|
2017-03-17 22:23:00 +08:00
|
|
|
meetingId: Auth.meetingID,
|
|
|
|
userId: Auth.userID,
|
2016-09-22 02:03:18 +08:00
|
|
|
}).user.emoji_status;
|
|
|
|
|
|
|
|
return {
|
2017-06-03 03:25:02 +08:00
|
|
|
userEmojiStatus,
|
|
|
|
credentials,
|
2016-09-22 02:03:18 +08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Below doesn't even need to receieve credentials
|
|
|
|
const setEmoji = (toRaiseUserId, status) => {
|
2017-04-26 21:47:44 +08:00
|
|
|
makeCall('setEmojiStatus', toRaiseUserId, status);
|
2016-09-22 02:03:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default {
|
|
|
|
getEmojiData,
|
|
|
|
setEmoji,
|
|
|
|
};
|