2016-05-05 02:29:43 +08:00
|
|
|
import { publish } from '/imports/startup/server/redispubsub';
|
|
|
|
import { isAllowedTo } from '/imports/startup/server/user_permissions';
|
|
|
|
import { appendMessageHeader } from '/imports/startup/server/helpers';
|
2016-04-29 06:01:43 +08:00
|
|
|
import { redisConfig } from '/config';
|
2016-04-28 05:04:15 +08:00
|
|
|
|
2016-04-20 01:43:31 +08:00
|
|
|
Meteor.methods({
|
|
|
|
userSetEmoji(meetingId, toRaiseUserId, raisedByUserId, raisedByToken, status) {
|
|
|
|
let message;
|
|
|
|
if (isAllowedTo('setEmojiStatus', meetingId, raisedByUserId, raisedByToken)) {
|
|
|
|
message = {
|
|
|
|
payload: {
|
|
|
|
emoji_status: status,
|
|
|
|
userid: toRaiseUserId,
|
|
|
|
meeting_id: meetingId,
|
2016-04-20 05:16:32 +08:00
|
|
|
}
|
2016-04-20 01:43:31 +08:00
|
|
|
};
|
|
|
|
|
2016-04-20 05:16:32 +08:00
|
|
|
message = appendMessageHeader('user_emoji_status_message', message);
|
2016-04-20 01:43:31 +08:00
|
|
|
// publish to pubsub
|
2016-04-29 06:01:43 +08:00
|
|
|
publish(redisConfig.channels.toBBBApps.users, message);
|
2016-04-20 01:43:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|