2019-05-17 04:11:10 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Captions from '/imports/api/captions';
|
|
|
|
import updateOwnerId from '/imports/api/captions/server/modifiers/updateOwnerId';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-02-09 23:59:59 +08:00
|
|
|
import { CAPTIONS_TOKEN } from '/imports/api/captions/server/helpers';
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
export default function takeOwnership(locale) {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
check(locale, String);
|
|
|
|
|
2021-02-09 23:59:59 +08:00
|
|
|
const pad = Captions.findOne({ meetingId, padId: { $regex: `${CAPTIONS_TOKEN}${locale}$` } });
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
if (pad) {
|
|
|
|
updateOwnerId(meetingId, requesterUserId, pad.padId);
|
|
|
|
}
|
|
|
|
}
|