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/client/startup/userSetUtcOffset.js

15 lines
458 B

import { Meteor } from 'meteor/meteor';
import moment from 'moment';
Meteor.startup(function() {
Tracker.autorun(function() {
const user = RocketChat.models.Users.findOne({ _id: Meteor.userId() }, { fields: { statusConnection: 1, utcOffset: 1 } });
if (user && user.statusConnection === 'online') {
const utcOffset = moment().utcOffset() / 60;
if (user.utcOffset !== utcOffset) {
Meteor.call('userSetUtcOffset', utcOffset);
}
}
});
});