Improve error messages
This commit is contained in:
parent
788383d8a1
commit
f69331e49d
@ -22,7 +22,7 @@ const mediaUpload = {
|
|||||||
const self = this
|
const self = this
|
||||||
const store = this.$store
|
const store = this.$store
|
||||||
if (file.size > store.state.instance.uploadlimit) {
|
if (file.size > store.state.instance.uploadlimit) {
|
||||||
self.$emit('upload-failed', 'upload_error_file_too_big')
|
self.$emit('upload-failed', 'upload_error_file_too_big', {filesize: file.size, allowedsize: store.state.instance.uploadlimit})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
@ -36,7 +36,7 @@ const mediaUpload = {
|
|||||||
self.$emit('uploaded', fileData)
|
self.$emit('uploaded', fileData)
|
||||||
self.uploading = false
|
self.uploading = false
|
||||||
}, (error) => { // eslint-disable-line handle-callback-err
|
}, (error) => { // eslint-disable-line handle-callback-err
|
||||||
self.$emit('upload-failed')
|
self.$emit('upload-failed', 'upload_error_generic')
|
||||||
self.uploading = false
|
self.uploading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -262,9 +262,9 @@ const PostStatusForm = {
|
|||||||
let index = this.newStatus.files.indexOf(fileInfo)
|
let index = this.newStatus.files.indexOf(fileInfo)
|
||||||
this.newStatus.files.splice(index, 1)
|
this.newStatus.files.splice(index, 1)
|
||||||
},
|
},
|
||||||
uploadFailed (errString) {
|
uploadFailed (errString, templateArgs) {
|
||||||
errString = errString || 'upload_error'
|
templateArgs = templateArgs || {};
|
||||||
this.error = this.$t('post_status.' + errString)
|
this.error = this.$t('post_status.upload_error') + ' ' + this.$t('post_status.' + errString, templateArgs)
|
||||||
this.enableSubmit()
|
this.enableSubmit()
|
||||||
},
|
},
|
||||||
disableSubmit () {
|
disableSubmit () {
|
||||||
|
@ -53,7 +53,8 @@
|
|||||||
"account_not_locked_warning_link": "locked",
|
"account_not_locked_warning_link": "locked",
|
||||||
"attachments_sensitive": "Mark attachments as sensitive",
|
"attachments_sensitive": "Mark attachments as sensitive",
|
||||||
"upload_error": "Upload failed.",
|
"upload_error": "Upload failed.",
|
||||||
"upload_error_file_too_big": "Upload failed. File too big",
|
"upload_error_file_too_big": "File too big [{filesize}/{allowedsize}]",
|
||||||
|
"upload_error_generic": "Try again later",
|
||||||
"content_type": {
|
"content_type": {
|
||||||
"plain_text": "Plain text"
|
"plain_text": "Plain text"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user