aboutsummaryrefslogtreecommitdiff
path: root/src/components/attachment/attachment.js
blob: 223249227ae2773e4d62894c9c149b05961b9228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import nsfwImage from '../../assets/nsfw.jpg'
import fileTypeService from '../../services/file_type/file_type.service.js'

const Attachment = {
  props: [
    'attachment',
    'nsfw',
    'statusId'
  ],
  data: () => ({
    nsfwImage,
    showHidden: false
  }),
  computed: {
    type () {
      return fileTypeService.fileType(this.attachment.mimetype)
    },
    hidden () {
      return this.nsfw && !this.showHidden
    }
  },
  methods: {
    toggleHidden () {
      this.showHidden = !this.showHidden
    }
  }
}

export default Attachment