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

14 lines
487 B

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