diff --git a/imports/message-read-receipt/client/readReceipts.html b/imports/message-read-receipt/client/readReceipts.html
index 3a81ee9cdcdfd..a4e3e43bace6d 100644
--- a/imports/message-read-receipt/client/readReceipts.html
+++ b/imports/message-read-receipt/client/readReceipts.html
@@ -6,7 +6,11 @@
{{#each receipts}}
-
- {{> avatar username=user.username}}
+ {{#if user}}
+ {{> avatar username=user.username}}
+ {{else}}
+ {{> avatar username=guest.username}}
+ {{/if}}
{{displayName}}
{{time}}
diff --git a/imports/message-read-receipt/client/readReceipts.js b/imports/message-read-receipt/client/readReceipts.js
index bc59874f85a4f..9a1fb6c07a158 100644
--- a/imports/message-read-receipt/client/readReceipts.js
+++ b/imports/message-read-receipt/client/readReceipts.js
@@ -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');
diff --git a/imports/message-read-receipt/server/lib/ReadReceipt.js b/imports/message-read-receipt/server/lib/ReadReceipt.js
index aa278884e0cda..abaf8aa02d579 100644
--- a/imports/message-read-receipt/server/lib/ReadReceipt.js
+++ b/imports/message-read-receipt/server/lib/ReadReceipt.js
@@ -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,
}));
},
};