Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable28] Fix file share with caption quote reply #11128

Merged
merged 2 commits into from Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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>