Updates #1261 More file upload fixes

This commit is contained in:
JC Brand 2018-10-26 14:39:04 +02:00
parent 98b27fbe0c
commit 2f9089ee10
3 changed files with 9 additions and 7 deletions

View File

@ -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();

View File

@ -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}

View File

@ -1,7 +1,7 @@
<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>