Commit 2f9089ee authored by JC Brand's avatar JC Brand

Updates #1261 More file upload fixes

parent 98b27fbe
......@@ -208,7 +208,8 @@ converse.plugins.add('converse-message-view', {
renderFileUploadProgresBar () {
const msg = u.stringToElement(tpl_file_progress(
_.extend(this.model.toJSON(), {
'filesize': filesize(this.model.file.size),
'filename': this.model.file.name,
'filesize': filesize(this.model.file.size)
})));
this.replaceElement(msg);
this.renderAvatar();
......
......@@ -206,8 +206,8 @@ converse.plugins.add('converse-chatboxes', {
});
};
xhr.open('PUT', this.get('put'), true);
xhr.setRequestHeader("Content-type", this.get('file').type);
xhr.send(this.get('file'));
xhr.setRequestHeader("Content-type", this.file.type);
xhr.send(this.file);
}
});
......@@ -331,8 +331,9 @@ converse.plugins.add('converse-chatboxes', {
}
stanza.c('reference', attrs).up();
});
if (message.get('file')) {
stanza.c('x', {'xmlns': Strophe.NS.OUTOFBAND}).c('url').t(message.get('message')).up();
if (message.get('oob_url')) {
stanza.c('x', {'xmlns': Strophe.NS.OUTOFBAND}).c('url').t(message.get('oob_url')).up();
}
if (message.get('edited')) {
stanza.c('replace', {
......@@ -440,7 +441,7 @@ converse.plugins.add('converse-chatboxes', {
const message = this.messages.create(
_.extend(
this.getOutgoingMessageAttributes(), {
'file': file,
'file': true,
'progress': 0,
'slot_request_url': slot_request_url
}), {'silent': true}
......
<div class="message chat-msg" data-isodate="{{{o.time}}}" data-msgid="{{{o.msgid}}}">
<canvas class="avatar chat-msg__avatar" height="36" width="36"></canvas>
<div class="chat-msg__content">
<span class="chat-msg__text">Uploading file: <strong>{{{o.file.name}}}</strong>, {{{o.filesize}}}</span>
<span class="chat-msg__text">Uploading file: <strong>{{{o.filename}}}</strong>, {{{o.filesize}}}</span>
<progress value="{{{o.progress}}}"/>
</div>
</div>
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