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/app/threads/client/flextab/threadlist.js

37 lines
981 B

import { Meteor } from 'meteor/meteor';
import { Session } from 'meteor/session';
import { TabBar } from '../../../ui-utils/client';
import { Subscriptions } from '../../../models/client';
Meteor.startup(function() {
return TabBar.addButton({
groups: ['channel', 'group', 'direct'],
id: 'thread',
full: true,
i18nTitle: 'Threads',
icon: 'thread',
template: 'threads',
badge: () => {
const subscription = Subscriptions.findOne({ rid: Session.get('openedRoom') }, { fields: { tunread: 1, tunreadUser: 1, tunreadGroup: 1 } });
if (!subscription?.tunread?.length) {
return;
}
const badgeClass = (() => {
if (subscription.tunreadUser?.length > 0) {
return 'rc-badge--user-mentions';
}
if (subscription.tunreadGroup?.length > 0) {
return 'rc-badge--group-mentions';
}
})();
return {
body: subscription.tunread.length > 99 ? '99+' : subscription.tunread.length,
class: badgeClass,
};
},
order: 2,
});
});