Compare commits

...

2 commits

Author SHA1 Message Date
Pranav Raj S
ba5bcba210 Avoid direct children from being hidden 2021-09-14 12:17:49 +05:30
Pranav Raj S
246b976610 fix: Hide quoted replies by default from messages 2021-09-14 00:25:36 +05:30
4 changed files with 89 additions and 16 deletions

View file

@ -12,6 +12,7 @@
:message="message" :message="message"
:is-email="isEmailContentType" :is-email="isEmailContentType"
:readable-time="readableTime" :readable-time="readableTime"
:display-quoted-button="displayQuotedButton"
/> />
<span <span
v-if="isPending && hasAttachments" v-if="isPending && hasAttachments"
@ -36,7 +37,6 @@
/> />
</div> </div>
</div> </div>
<bubble-actions <bubble-actions
:id="data.id" :id="data.id"
:sender="data.sender" :sender="data.sender"
@ -128,6 +128,24 @@ export default {
}; };
}, },
computed: { computed: {
contentToBeParsed() {
const {
html_content: { full: fullHTMLContent } = {},
text_content: { full: fullTextContent } = {},
} = this.contentAttributes.email || {};
return fullHTMLContent || fullTextContent || '';
},
displayQuotedButton() {
if (!this.isIncoming) {
return false;
}
if (this.contentToBeParsed.includes('<blockquote')) {
return true;
}
return false;
},
message() { message() {
const botMessageContent = generateBotMessageContent( const botMessageContent = generateBotMessageContent(
this.contentType, this.contentType,
@ -142,20 +160,10 @@ export default {
); );
const { const {
email: { email: { content_type: contentType = '' } = {},
content_type: contentType = '',
html_content: { full: fullHTMLContent, reply: replyHTMLContent } = {},
text_content: { full: fullTextContent, reply: replyTextContent } = {},
} = {},
} = this.contentAttributes; } = this.contentAttributes;
let contentToBeParsed = if (this.contentToBeParsed && this.isIncoming) {
replyHTMLContent || const parsedContent = this.stripStyleCharacters(this.contentToBeParsed);
replyTextContent ||
fullHTMLContent ||
fullTextContent ||
'';
if (contentToBeParsed && this.isIncoming) {
const parsedContent = this.stripStyleCharacters(contentToBeParsed);
if (parsedContent) { if (parsedContent) {
// This is a temporary fix for line-breaks in text/plain emails // This is a temporary fix for line-breaks in text/plain emails
// Now, It is not rendered properly in the email preview. // Now, It is not rendered properly in the email preview.

View file

@ -1,6 +1,26 @@
<template> <template>
<div class="message-text__wrap"> <div
class="message-text__wrap"
:class="{
'show--quoted': showQuotedContent,
'hide--quoted': !showQuotedContent,
}"
>
<div class="text-content" v-html="message"></div> <div class="text-content" v-html="message"></div>
<button
v-if="displayQuotedButton"
class="quoted-text--button"
@click="toggleQuotedContent"
>
<span v-if="showQuotedContent">
<i class="ion-chevron-up" />
{{ $t('CHAT_LIST.HIDE_QUOTED_TEXT') }}
</span>
<span v-else>
<i class="ion-chevron-down" />
{{ $t('CHAT_LIST.SHOW_QUOTED_TEXT') }}
</span>
</button>
</div> </div>
</template> </template>
@ -19,6 +39,20 @@ export default {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
displayQuotedButton: {
type: Boolean,
default: false,
},
},
data() {
return {
showQuotedContent: false,
};
},
methods: {
toggleQuotedContent() {
this.showQuotedContent = !this.showQuotedContent;
},
}, },
}; };
</script> </script>
@ -52,5 +86,33 @@ export default {
h6 { h6 {
font-size: var(--font-size-normal); font-size: var(--font-size-normal);
} }
& > blockquote {
display: block !important;
}
& > div:first-child > blockquote {
display: block;
}
}
.show--quoted {
blockquote {
display: block;
}
}
.hide--quoted {
blockquote {
display: none;
}
}
.quoted-text--button {
color: var(--s-400);
cursor: pointer;
font-size: var(--font-size-mini);
padding-bottom: var(--space-small);
padding-top: var(--space-small);
} }
</style> </style>

View file

@ -85,6 +85,8 @@
"VIEW_TWEET_IN_TWITTER": "View tweet in Twitter", "VIEW_TWEET_IN_TWITTER": "View tweet in Twitter",
"REPLY_TO_TWEET": "Reply to this tweet", "REPLY_TO_TWEET": "Reply to this tweet",
"NO_MESSAGES": "No Messages", "NO_MESSAGES": "No Messages",
"NO_CONTENT": "No content available" "NO_CONTENT": "No content available",
"HIDE_QUOTED_TEXT": "Hide Quoted Text",
"SHOW_QUOTED_TEXT": "Show Quoted Text"
} }
} }

View file

@ -34,6 +34,7 @@ export default {
'lang', 'lang',
'align', 'align',
'size', 'size',
'border',
], ],
}); });
}, },