fix: Hide quoted replies by default from messages (#3009)
Fixes: #2009 , #2365
This commit is contained in:
parent
22d1c8baf2
commit
aa5d01b572
4 changed files with 81 additions and 16 deletions
|
@ -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.
|
||||||
|
|
|
@ -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>
|
||||||
|
@ -53,4 +87,24 @@ export default {
|
||||||
font-size: var(--font-size-normal);
|
font-size: var(--font-size-normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.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>
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ export default {
|
||||||
'lang',
|
'lang',
|
||||||
'align',
|
'align',
|
||||||
'size',
|
'size',
|
||||||
|
'border',
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue