add attachment's URLs to message header
This commit is contained in:
@@ -129,7 +129,7 @@ Sample JSON representation of the text above:
|
|||||||
},
|
},
|
||||||
IM: {
|
IM: {
|
||||||
open: function(data) {
|
open: function(data) {
|
||||||
// Don't use data.ref for preview: it's a security risk.
|
// Don't use data.ref for preview: it's a security risk.
|
||||||
var previewUrl = base64toObjectUrl(data.val, data.mime);
|
var previewUrl = base64toObjectUrl(data.val, data.mime);
|
||||||
var downloadUrl = data.ref ? data.ref : previewUrl;
|
var downloadUrl = data.ref ? data.ref : previewUrl;
|
||||||
var res = (data.name ? '<a href="' + downloadUrl + '" download="' + data.name + '">' : '') +
|
var res = (data.name ? '<a href="' + downloadUrl + '" download="' + data.name + '">' : '') +
|
||||||
|
|||||||
+12
-2
@@ -4460,13 +4460,23 @@
|
|||||||
// Check if the message is formatted.
|
// Check if the message is formatted.
|
||||||
var dft = Drafty.parse(msg) || msg;
|
var dft = Drafty.parse(msg) || msg;
|
||||||
if (Drafty.isPlainText(dft)) {
|
if (Drafty.isPlainText(dft)) {
|
||||||
// The message is simple text. Sned if as text/plain.
|
// The message is unformatted text. Send if as text/plain.
|
||||||
topic.publish(msg).catch(function(err) {
|
topic.publish(msg).catch(function(err) {
|
||||||
instance.handleError(err.message, "err");
|
instance.handleError(err.message, "err");
|
||||||
});;
|
});;
|
||||||
} else {
|
} else {
|
||||||
|
// The message is a Drafty object.
|
||||||
|
var attachments = [];
|
||||||
|
dft.attachments(function(data) {
|
||||||
|
if (data.ref) {
|
||||||
|
attachments.push(data.ref);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (attachments.length < 1) {
|
||||||
|
attachments = null;
|
||||||
|
}
|
||||||
// Formatted message. Send it as a Drafty object.
|
// Formatted message. Send it as a Drafty object.
|
||||||
topic.publish(dft, undefined, Drafty.getContentType()).catch(function(err) {
|
topic.publish(dft, undefined, Drafty.getContentType(), attachments).catch(function(err) {
|
||||||
instance.handleError(err.message, "err");
|
instance.handleError(err.message, "err");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user