Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
knrt10 committed Mar 21, 2019
1 parent 805a7eb commit 713fcae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion imports/message-read-receipt/client/readReceipts.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
<ul class="read-receipts">
{{#each receipts}}
<li class="read-receipts__user background-transparent-dark-hover">
{{> avatar username=user.username}}
{{#if user}}
{{> avatar username=user.username}}
{{else}}
{{> avatar username=guest.name}}
{{/if}}
<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>
Expand Down
5 changes: 4 additions & 1 deletion imports/message-read-receipt/client/readReceipts.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Template.readReceipts.helpers({
return Template.instance().readReceipts.get();
},
displayName() {
return (settings.get('UI_Use_Real_Name') && this.user.name) || this.user.username;
if (this.user) {
return (settings.get('UI_Use_Real_Name') && this.user.name) || this.user.username;
}
return this.guest.name;
},
time() {
return moment(this.ts).format('L LTS');
Expand Down
1 change: 1 addition & 0 deletions imports/message-read-receipt/server/lib/ReadReceipt.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const ReadReceipt = {
return ReadReceipts.findByMessageId(message._id).map((receipt) => ({
...receipt,
user: Users.findOneById(receipt.userId, { fields: { username: 1, name: 1 } }),
guest: message.u,
}));
},
};

0 comments on commit 713fcae

Please sign in to comment.