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/imports/message-read-receipt/client/readReceipts.js

36 lines
907 B

import { ReactiveVar } from 'meteor/reactive-var';
import moment from 'moment';
import './readReceipts.css';
import './readReceipts.html';
Template.readReceipts.helpers({
receipts() {
return Template.instance().readReceipts.get();
},
displayName() {
return (RocketChat.settings.get('UI_Use_Real_Name') && this.user.name) || this.user.username;
},
time() {
return moment(this.ts).format('L LTS');
},
isLoading() {
return Template.instance().loading.get();
}
});
Template.readReceipts.onCreated(function readReceiptsOnCreated() {
this.loading = new ReactiveVar(false);
this.readReceipts = new ReactiveVar([]);
});
Template.readReceipts.onRendered(function readReceiptsOnRendered() {
this.loading.set(true);
Meteor.call('getReadReceipts', { messageId: this.data.messageId }, (error, result) => {
if (!error) {
this.readReceipts.set(result);
}
this.loading.set(false);
});
});