Merge branch '631' into 'develop'
Hide image block in rich media preview in case of broken image Closes #631 See merge request pleroma/pleroma-fe!902
This commit is contained in:
commit
acb788d575
@ -5,6 +5,11 @@ const LinkPreview = {
|
||||
'size',
|
||||
'nsfw'
|
||||
],
|
||||
data () {
|
||||
return {
|
||||
imageLoaded: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
useImage () {
|
||||
// Currently BE shoudn't give cards if tagged NSFW, this is a bit paranoid
|
||||
@ -15,6 +20,15 @@ const LinkPreview = {
|
||||
useDescription () {
|
||||
return this.card.description && /\S/.test(this.card.description)
|
||||
}
|
||||
},
|
||||
created () {
|
||||
if (this.useImage) {
|
||||
const newImg = new Image()
|
||||
newImg.onload = () => {
|
||||
this.imageLoaded = true
|
||||
}
|
||||
newImg.src = this.card.image
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
rel="noopener"
|
||||
>
|
||||
<div
|
||||
v-if="useImage"
|
||||
v-if="useImage && imageLoaded"
|
||||
class="card-image"
|
||||
:class="{ 'small-image': size === 'small' }"
|
||||
>
|
||||
|
Loading…
Reference in New Issue
Block a user