Handling emoji messages
This commit is contained in:
parent
0cdda4f8cb
commit
54234cecac
@ -8,7 +8,7 @@ import setEmojiStatus from './methods/setEmojiStatus';
|
||||
import validateAuthToken from './methods/validateAuthToken';
|
||||
import mapToAcl from '/imports/startup/mapToAcl';
|
||||
|
||||
Meteor.methods(mapToAcl(['methods.kickUser', 'methods.listenOnlyToggle', 'methods.userLogout',
|
||||
Meteor.methods(/*mapToAcl(['methods.kickUser', 'methods.listenOnlyToggle', 'methods.userLogout',
|
||||
'methods.assignPresenter', 'methods.setEmojiStatus', 'methods.muteUser', 'methods.unmuteUser',
|
||||
], {
|
||||
kickUser,
|
||||
@ -18,6 +18,6 @@ Meteor.methods(mapToAcl(['methods.kickUser', 'methods.listenOnlyToggle', 'method
|
||||
setEmojiStatus,
|
||||
muteUser: (...args) => muteToggle(...args, true),
|
||||
unmuteUser: (...args) => muteToggle(...args, false),
|
||||
}));
|
||||
})*/);
|
||||
|
||||
Meteor.methods({ validateAuthToken });
|
||||
|
@ -3,10 +3,10 @@ import { check } from 'meteor/check';
|
||||
import Users from '/imports/api/2.0/users';
|
||||
|
||||
export default function handleEmojiStatus({ body }, meetingId) {
|
||||
const { userId, status } = body;
|
||||
const { userId, emoji } = body;
|
||||
|
||||
check(userId, String);
|
||||
check(status, String);
|
||||
check(emoji, String);
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
@ -16,7 +16,7 @@ export default function handleEmojiStatus({ body }, meetingId) {
|
||||
const modifier = {
|
||||
$set: {
|
||||
'user.set_emoji_time': (new Date()).getTime(),
|
||||
'user.emoji_status': status,
|
||||
'user.emoji': emoji,
|
||||
},
|
||||
};
|
||||
|
||||
@ -27,7 +27,7 @@ export default function handleEmojiStatus({ body }, meetingId) {
|
||||
|
||||
if (numChanged) {
|
||||
return Logger.info(`Assigned user emoji status${
|
||||
status} id=${userId} meeting=${meetingId}`,
|
||||
emoji} id=${userId} meeting=${meetingId}`,
|
||||
);
|
||||
}
|
||||
};
|
||||
|
@ -1,20 +1,13 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
// import kickUser from './methods/kickUser';
|
||||
import listenOnlyToggle from './methods/listenOnlyToggle';
|
||||
import mapToAcl from '/imports/startup/mapToAcl';
|
||||
import userLogout from './methods/userLogout';
|
||||
import validateAuthToken from './methods/validateAuthToken';
|
||||
import mapToAcl from '/imports/startup/mapToAcl';
|
||||
import setEmojiStatus from './methods/setEmojiStatus';
|
||||
|
||||
Meteor.methods(mapToAcl(['methods.kickUser', 'methods.listenOnlyToggle', 'methods.userLogout',
|
||||
'methods.assignPresenter', 'methods.setEmojiStatus', 'methods.muteUser', 'methods.unmuteUser',
|
||||
], {
|
||||
// kickUser,
|
||||
// listenOnlyToggle,
|
||||
// userLogout,
|
||||
// assignPresenter,
|
||||
// setEmojiStatus,
|
||||
// muteUser: (...args) => muteToggle(...args, true),
|
||||
// unmuteUser: (...args) => muteToggle(...args, false),
|
||||
}));
|
||||
Meteor.methods(mapToAcl(['methods.userLogout', 'methods.setEmojiStatus',
|
||||
], {
|
||||
userLogout,
|
||||
setEmojiStatus,
|
||||
}));
|
||||
|
||||
Meteor.methods({ validateAuthToken2x: validateAuthToken });
|
||||
|
32
bigbluebutton-html5/imports/api/2.0/users/server/methods/setEmojiStatus.js
Executable file
32
bigbluebutton-html5/imports/api/2.0/users/server/methods/setEmojiStatus.js
Executable file
@ -0,0 +1,32 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import RedisPubSub from '/imports/startup/server/redis2x';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function setEmojiStatus(credentials, userId, status) {
|
||||
const REDIS_CONFIG = Meteor.settings.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeUserEmojiCmdMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(userId, String);
|
||||
|
||||
const payload = {
|
||||
emoji: status,
|
||||
userId,
|
||||
};
|
||||
|
||||
const header = {
|
||||
meetingId,
|
||||
name: EVENT_NAME,
|
||||
userId: requesterUserId,
|
||||
};
|
||||
|
||||
Logger.verbose(`User '${userId}' emoji status updated to '${status}' by '${
|
||||
requesterUserId}' from meeting '${meetingId}'`);
|
||||
|
||||
return RedisPubSub.publish(CHANNEL, EVENT_NAME, meetingId, payload, header);
|
||||
}
|
@ -59,8 +59,8 @@ export default function userLeaving(credentials, userId) {
|
||||
}
|
||||
|
||||
const payload = {
|
||||
meeting_id: meetingId,
|
||||
userid: userId,
|
||||
meetingId,
|
||||
userId,
|
||||
};
|
||||
|
||||
Logger.verbose(`User '${requesterUserId}' left meeting '${meetingId}'`);
|
||||
|
@ -51,7 +51,7 @@ export default function addUser(meetingId, user) {
|
||||
'user.avatarURL': user.avatar,
|
||||
'user.set_emoji_time': user.set_emoji_time || (new Date()).getTime(),
|
||||
'user.joiningTime': (new Date()).getTime(),
|
||||
'user.emoji_status': user.emoji,
|
||||
'user.emoji': user.emoji,
|
||||
'user.presenter': user.presenter,
|
||||
'user.locked': user.locked,
|
||||
'user.listenOnly': user.listenOnly,
|
||||
|
@ -22,7 +22,7 @@ export default function removeUser(meetingId, userId) {
|
||||
'user.time_of_joining': 0,
|
||||
'user.listenOnly': false,
|
||||
'user.validated': false,
|
||||
'user.emoji_status': 'none',
|
||||
'user.emoji': 'none',
|
||||
'user.presenter': false,
|
||||
'user.role': 'VIEWER',
|
||||
},
|
||||
|
@ -11,7 +11,7 @@ const getEmojiData = () => {
|
||||
const userEmojiStatus = Users.findOne({
|
||||
meetingId: Auth.meetingID,
|
||||
userId: Auth.userID,
|
||||
}).user.emoji_status;
|
||||
}).user.emoji;
|
||||
|
||||
return {
|
||||
userEmojiStatus,
|
||||
|
@ -31,7 +31,7 @@ const mapUser = user => ({
|
||||
id: user.userid,
|
||||
name: user.name,
|
||||
emoji: {
|
||||
status: user.emoji_status,
|
||||
status: user.emoji,
|
||||
changedAt: user.set_emoji_time,
|
||||
},
|
||||
isPresenter: user.presenter,
|
||||
|
@ -20,7 +20,7 @@ const mapUser = user => ({
|
||||
id: user.userid,
|
||||
name: user.name,
|
||||
emoji: {
|
||||
status: user.emoji_status,
|
||||
status: user.emoji,
|
||||
changedAt: user.set_emoji_time,
|
||||
},
|
||||
isPresenter: user.presenter,
|
||||
|
Loading…
Reference in New Issue
Block a user