The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/server/startup/migrations/v045.js

17 lines
589 B

import { Migrations } from '../../../app/migrations';
import { Users } from '../../../app/models';
import { settings } from '../../../app/settings';
Migrations.add({
version: 45,
up() {
// finds the latest created visitor
const lastVisitor = Users.find({ type: 'visitor' }, { fields: { username: 1 }, sort: { createdAt: -1 }, limit: 1 }).fetch();
if (lastVisitor && lastVisitor.length > 0) {
const lastNumber = lastVisitor[0].username.replace(/^guest\-/, '');
settings.add('Livechat_guest_count', parseInt(lastNumber) + 1, { type: 'int', group: 'Livechat' });
}
},
});