pleroma-fe/src/components/attachment/attachment.js
2016-11-22 21:45:18 +03:00

41 lines
748 B
JavaScript

import nsfwImage from '../../assets/nsfw.jpg'
const Attachment = {
props: [
'attachment',
'nsfw',
'statusId'
],
data: () => ({ nsfwImage }),
computed: {
type () {
let type = 'unknown'
if (this.attachment.mimetype.match(/text\/html/)) {
type = 'html'
}
if (this.attachment.mimetype.match(/image/)) {
type = 'image'
}
if (this.attachment.mimetype.match(/video\/(webm|mp4)/)) {
type = 'video'
};
if (this.attachment.mimetype.match(/ogg|audio/)) {
type = 'audio'
}
return type
}
},
methods: {
showNsfw () {
this.$store.commit('setNsfw', { id: this.statusId, nsfw: false })
}
}
}
export default Attachment