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-version-check/client/client.js

30 lines
796 B

/* globals alerts */
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';
Meteor.startup(function() {
Tracker.autorun(() => {
const user = Meteor.user();
if (user && Object.keys(user.banners || {}).length > 0) {
const firstBanner = Object.values(user.banners).sort((a, b) => b.priority - a.priority)[0];
firstBanner.textArguments = firstBanner.textArguments || [];
alerts.open({
title: TAPi18n.__(firstBanner.title),
text: TAPi18n.__(firstBanner.text, ...firstBanner.textArguments),
modifiers: firstBanner.modifiers,
action() {
if (firstBanner.link) {
window.open(firstBanner.link, '_system');
}
},
onClose() {
Meteor.call('banner/dismiss', {
id: firstBanner.id,
});
},
});
}
});
});