aboutsummaryrefslogtreecommitdiff
path: root/src/components/link-preview/link-preview.js
blob: 2f6da55e9f78914ecdace1fc8891241ed96fd8d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const LinkPreview = {
  name: 'LinkPreview',
  props: [
    '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)
    }
  }
}

export default LinkPreview