akkoma-fe/src/components/link-preview/link-preview.js

22 lines
513 B
JavaScript
Raw Normal View History

2019-01-27 13:47:30 +00:00
const LinkPreview = {
name: 'LinkPreview',
props: [
2019-01-27 20:33:36 +00:00
'card',
'size',
'nsfw'
],
computed: {
useImage () {
// Currently BE shoudn't give cards if tagged NSFW, this is a bit paranoid
// as it makes sure to hide the image if somehow NSFW tagged preview can
// exist.
return this.card.image && !this.nsfw && this.size !== 'hide'
},
useDescription () {
return this.card.description && /\S/.test(this.card.description)
}
}
2019-01-27 13:47:30 +00:00
}
export default LinkPreview