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/apps/meteor/client/startup/userSetUtcOffset.ts

27 lines
575 B

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import moment from 'moment';
import { Users } from '../../app/models/client';
Meteor.startup(() => {
Tracker.autorun((c) => {
const status = Meteor.status();
if (!status.connected) {
return;
}
if (!Meteor.userId()) {
return;
}
const user = Users.findOne({ _id: Meteor.userId() }, { fields: { utcOffset: 1 } });
const utcOffset = moment().utcOffset() / 60;
if (user.utcOffset !== utcOffset) {
Meteor.call('userSetUtcOffset', utcOffset);
}
c.stop();
});
});