diff options
| author | Roger Braun <roger@rogerbraun.net> | 2016-10-29 01:38:41 +0200 |
|---|---|---|
| committer | Roger Braun <roger@rogerbraun.net> | 2016-10-29 01:38:41 +0200 |
| commit | 500b704c0f93059b75b8943e3351cdac63270b0f (patch) | |
| tree | 799e790b4f2bf929fd3798d1b3b99473e58cab31 /src/components/attachment/attachment.js | |
| parent | 5f690145755c3972268e2750808ac98dcc17af90 (diff) | |
Fix up nsfw and some styling.
Diffstat (limited to 'src/components/attachment/attachment.js')
| -rw-r--r-- | src/components/attachment/attachment.js | 21 |
1 files changed, 18 insertions, 3 deletions
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 }) } } } |
