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/packages/rocketchat-lib/client/lib/startup/commands.js

21 lines
579 B

import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
import { slashCommands, APIClient } from 'meteor/rocketchat:utils';
// Track logins and when they login, get the commands
(() => {
let oldUserId = null;
Tracker.autorun(() => {
const newUserId = Meteor.userId();
if (oldUserId === null && newUserId) {
APIClient.v1.get('commands.list').then(function _loadedCommands(result) {
result.commands.forEach((command) => {
slashCommands.commands[command.command] = command;
});
});
}
oldUserId = Meteor.userId();
});
})();