From b2b668b54410af3a5ffffa5c50db35bb091e0561 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 4 Aug 2019 22:02:10 -0600 Subject: [PATCH] Update compose modal --- .../assets/js/components/ComposeModal.vue | 51 +++++++++++-------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index 17b8e7359..e81241762 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -37,7 +37,11 @@

Add Photo

-

{{composeMessage()}}

+
+

{{composeMessage()}}

+

Accepted Formats: {{acceptedFormats()}}

+

Max File Size: {{maxSize()}}

+
@@ -173,19 +177,20 @@ {{composeText.length}} / {{config.uploader.max_caption_length}}
-
+ + Delete - ->
-
+ --> + @@ -218,11 +223,7 @@ export default { data() { return { - config: { - uploader: { - media_types: '', - } - }, + config: window.App.config, profile: {}, composeText: '', composeTextLength: 0, @@ -241,7 +242,6 @@ export default { }, beforeMount() { - this.fetchConfig(); this.fetchProfile(); }, @@ -290,20 +290,10 @@ export default { ['Willow','filter-willow'], ['X-Pro II','filter-xpro-ii'] ]; - + console.log(this.config); }, methods: { - - fetchConfig() { - axios.get('/api/v2/config').then(res => { - this.config = res.data; - if(this.config.uploader.media_types.includes('video/mp4') == false) { - this.composeType = 'post' - } - }); - }, - fetchProfile() { axios.get('/api/v1/accounts/verify_credentials').then(res => { this.profile = res.data; @@ -464,6 +454,11 @@ export default { let data = res.data; window.location.href = data; }).catch(err => { + let res = err.response.data; + if(res.message == 'Too Many Attempts.') { + swal('You\'re posting too much!', 'We only allow 50 posts per hour or 100 per day. If you\'ve reached that limit, please try again later. If you think this is an error, please contact an administrator.', 'error'); + return; + } swal('Oops, something went wrong!', 'An unexpected error occurred.', 'error'); }); return; @@ -511,6 +506,18 @@ export default { createCollection() { window.location.href = '/i/collections/create'; + }, + + maxSize() { + let limit = this.config.uploader.max_photo_size; + return limit / 1000 + ' MB'; + }, + + acceptedFormats() { + let formats = this.config.uploader.media_types; + return formats.split(',').map(f => { + return ' ' + f.split('/')[1]; + }).toString(); } } }