From 500b704c0f93059b75b8943e3351cdac63270b0f Mon Sep 17 00:00:00 2001 From: Roger Braun Date: Sat, 29 Oct 2016 01:38:41 +0200 Subject: Fix up nsfw and some styling. --- src/components/attachment/attachment.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/components/attachment/attachment.js') diff --git a/src/components/attachment/attachment.js b/src/components/attachment/attachment.js index c21cd656..161c6b2b 100644 --- a/src/components/attachment/attachment.js +++ b/src/components/attachment/attachment.js @@ -3,17 +3,32 @@ import nsfwImage from '../../assets/nsfw.jpg' const Attachment = { props: [ 'attachment', - 'nsfw' + 'nsfw', + 'statusId' ], data: () => ({ nsfwImage }), computed: { type () { - return 'image' + 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/)) { + type = 'webm'; + }; + + return type } }, methods: { showNsfw () { - this.nsfw = false + this.$store.commit('setNsfw', { id: this.statusId, nsfw: false }) } } } -- cgit v1.2.3-70-g09d2