2019-05-17 04:11:10 +08:00
|
|
|
import Captions from '/imports/api/captions';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-05-22 03:21:46 +08:00
|
|
|
import updateOwner from '/imports/api/captions/server/methods/updateOwner';
|
2019-05-17 04:11:10 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
export default function updateOwnerId(meetingId, userId, padId) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
|
|
|
check(padId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
padId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
ownerId: userId,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-11-27 00:23:57 +08:00
|
|
|
try {
|
|
|
|
const numberAffected = Captions.update(selector, modifier, { multi: true });
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2020-11-27 00:23:57 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
updateOwner(meetingId, userId, padId);
|
|
|
|
Logger.verbose('Captions: updated caption', { padId, ownerId: userId });
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error('Captions: error while updating pad', { err });
|
|
|
|
}
|
2019-05-17 04:11:10 +08:00
|
|
|
}
|