From 55b3f591c6076c0182f4411a9b969cd5b4bc6f57 Mon Sep 17 00:00:00 2001
From: Joas Schilling <coding@schilljs.com>
Date: Tue, 7 Jan 2020 16:47:54 +0100
Subject: Fix missing "Guests" placeholder on quotes

Signed-off-by: Joas Schilling <coding@schilljs.com>
---
 src/components/Quote.vue | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

(limited to 'src/components/Quote.vue')

diff --git a/src/components/Quote.vue b/src/components/Quote.vue
index 4cf308422..df1147711 100644
--- a/src/components/Quote.vue
+++ b/src/components/Quote.vue
@@ -28,7 +28,7 @@ components.
 	<div class="quote">
 		<div class="quote__main">
 			<div class="quote__main__author">
-				<h6>{{ actorDisplayName }}</h6>
+				<h6>{{ getDisplayName }}</h6>
 			</div>
 			<div class="quote__main__text">
 				<p>{{ shortenQuotedMessage }}</p>
@@ -59,6 +59,10 @@ export default {
 		/**
 		 * The sender of the message to be replied to.
 		 */
+		actorType: {
+			type: String,
+			required: true,
+		},
 		actorDisplayName: {
 			type: String,
 			required: true,
@@ -101,6 +105,24 @@ export default {
 		},
 	},
 	computed: {
+		/**
+		 * The message actor display name.
+		 * @returns {string}
+		 */
+		getDisplayName() {
+			const displayName = this.actorDisplayName.trim()
+
+			if (displayName === '' && this.actorType === 'guests') {
+				return t('spreed', 'Guest')
+			}
+
+			if (displayName === '') {
+				return t('spreed', '[Unknown user name]')
+			}
+
+			return displayName
+		},
+
 		/**
 		 * This is a simplified version of the last chat message.
 		 * Parameters are parsed without markup (just replaced with the name),
-- 
cgit v1.2.3

