summaryrefslogtreecommitdiffstats
path: root/src/components/Quote.vue
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-01-07 16:47:54 +0100
committerJoas Schilling <coding@schilljs.com>2020-01-07 16:47:54 +0100
commit55b3f591c6076c0182f4411a9b969cd5b4bc6f57 (patch)
treede35217a561c0c31496c880e9d2edadae90430c4 /src/components/Quote.vue
parent1dc2201dd87ed39a47af83ac42a995ec7d25dcea (diff)
Fix missing "Guests" placeholder on quotes
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src/components/Quote.vue')
-rw-r--r--src/components/Quote.vue24
1 files changed, 23 insertions, 1 deletions
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,
@@ -102,6 +106,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),
* e.g. no avatars on mentions.