Commit 5cd7ccb3 authored by Emmanuel Gil Peyrot's avatar Emmanuel Gil Peyrot Committed by JC Brand

Correctly display error when HTTP File Upload isn’t supported by the server.

parent 0d4603d8
...@@ -70983,8 +70983,17 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha ...@@ -70983,8 +70983,17 @@ _converse_core__WEBPACK_IMPORTED_MODULE_2__["default"].plugins.add('converse-cha
async sendFiles(files) { async sendFiles(files) {
const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain), const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain),
item = result.pop(), item = result.pop();
data = item.dataforms.where({
if (!item) {
this.messages.create({
'message': __("Sorry, looks like file upload is not supported by your server."),
'type': 'error'
});
return;
}
const data = item.dataforms.where({
'FORM_TYPE': { 'FORM_TYPE': {
'value': Strophe.NS.HTTPUPLOAD, 'value': Strophe.NS.HTTPUPLOAD,
'type': "hidden" 'type': "hidden"
...@@ -418,8 +418,17 @@ converse.plugins.add('converse-chatboxes', { ...@@ -418,8 +418,17 @@ converse.plugins.add('converse-chatboxes', {
async sendFiles (files) { async sendFiles (files) {
const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain), const result = await _converse.api.disco.supports(Strophe.NS.HTTPUPLOAD, _converse.domain),
item = result.pop(), item = result.pop();
data = item.dataforms.where({'FORM_TYPE': {'value': Strophe.NS.HTTPUPLOAD, 'type': "hidden"}}).pop(),
if (!item) {
this.messages.create({
'message': __("Sorry, looks like file upload is not supported by your server."),
'type': 'error'
});
return;
}
const data = item.dataforms.where({'FORM_TYPE': {'value': Strophe.NS.HTTPUPLOAD, 'type': "hidden"}}).pop(),
max_file_size = window.parseInt(_.get(data, 'attributes.max-file-size.value')), max_file_size = window.parseInt(_.get(data, 'attributes.max-file-size.value')),
slot_request_url = _.get(item, 'id'); slot_request_url = _.get(item, 'id');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment