[FIX] Read receipts are broken (#22203)

pull/21253/head
pierre-lehnen-rc 5 years ago committed by GitHub
parent e3f6c5cade
commit 043eb51623
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/message-read-receipt/client/index.js
  2. 16
      app/message-read-receipt/client/views/readReceipts.html
  3. 39
      app/message-read-receipt/client/views/readReceipts.js
  4. 1
      client/importPackages.ts

@ -0,0 +1 @@
import './views/readReceipts';

@ -0,0 +1,16 @@
<template name="readReceipts">
{{#if isLoading}}
{{> loading class="loading-animation--primary"}}
{{else}}
<p>{{_ "Read_by"}}:</p>
<ul class="read-receipts">
{{#each receipts}}
<li class="read-receipts__user background-transparent-dark-hover">
{{> avatar username=user.username}}
<div class="read-receipts__name color-primary-font-color">{{displayName}}</div>
<span class="read-receipts__time color-info-font-color" title="{{dateTime}}">{{time}}</span>
</li>
{{/each}}
</ul>
{{/if}}
</template>

@ -0,0 +1,39 @@
import { Meteor } from 'meteor/meteor';
import { ReactiveVar } from 'meteor/reactive-var';
import { Template } from 'meteor/templating';
import moment from 'moment';
import { settings } from '../../../settings';
import './readReceipts.html';
Template.readReceipts.helpers({
receipts() {
return Template.instance().readReceipts.get();
},
displayName() {
return (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);
});
});

@ -94,3 +94,4 @@ import '../app/livechat/client';
import '../app/meteor-autocomplete/client';
import '../app/theme/client';
import '../app/custom/client';
import '../app/message-read-receipt/client';

Loading…
Cancel
Save