Skip to content

Commit

Permalink
Merge pull request #11128 from nextcloud/backport/11120/stable28
Browse files Browse the repository at this point in the history
[stable28] Fix file share with caption quote reply
  • Loading branch information
DorraJaouad committed Dec 5, 2023
2 parents b6455d2 + b8afbf2 commit 84dc2dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
14 changes: 8 additions & 6 deletions src/components/NewMessage/NewMessage.vue
Expand Up @@ -506,6 +506,14 @@ export default {
}
}
// FIXME upstream: https://github.com/nextcloud-libraries/nextcloud-vue/issues/4492
if (this.hasText) {
const temp = document.createElement('textarea')
temp.innerHTML = this.text.replace(/&/gmi, '&')
this.text = temp.value.replace(/&amp;/gmi, '&').replace(/&lt;/gmi, '<')
.replace(/&gt;/gmi, '>').replace(/&sect;/gmi, '§')
}
if (this.upload) {
// Clear input content from store
this.$store.dispatch('setCurrentMessageInput', { token: this.token, text: '' })
Expand All @@ -521,12 +529,6 @@ export default {
}
if (this.hasText) {
// FIXME upstream: https://github.com/nextcloud-libraries/nextcloud-vue/issues/4492
const temp = document.createElement('textarea')
temp.innerHTML = this.text.replace(/&/gmi, '&amp;')
this.text = temp.value.replace(/&amp;/gmi, '&').replace(/&lt;/gmi, '<')
.replace(/&gt;/gmi, '>').replace(/&sect;/gmi, '§')
const temporaryMessage = await this.$store.dispatch('createTemporaryMessage', {
text: this.text.trim(),
token: this.token,
Expand Down
21 changes: 14 additions & 7 deletions src/components/Quote.vue
Expand Up @@ -41,13 +41,13 @@ components.
disable-menu />
{{ getDisplayName }}
</div>
<div v-if="isFileShareMessage"
class="quote__main__text">
<NcRichText :text="message"
:arguments="richParameters"
:autolink="true" />
</div>
<blockquote v-else
<!-- file preview-->
<NcRichText v-if="isFileShareMessage"
text="{file}"
class="quote__file-preview"
:arguments="richParameters" />
<!-- text -->
<blockquote v-if="!isFileShareWithoutCaption"
class="quote__main__text">
<p dir="auto">{{ shortenedQuoteMessage }}</p>
</blockquote>
Expand Down Expand Up @@ -175,6 +175,10 @@ export default {
return Object.keys(Object(this.messageParameters)).some(key => key.startsWith('file'))
},
isFileShareWithoutCaption() {
return this.isFileShareMessage && this.message === '{file}'
},
richParameters() {
const richParameters = {}
Object.keys(this.messageParameters).forEach(function(p) {
Expand Down Expand Up @@ -324,6 +328,9 @@ export default {
position: relative;
margin: auto;
}
&__file-preview {
line-height: 0.5 !important;
}
}
</style>

0 comments on commit 84dc2dd

Please sign in to comment.