Commit 29919b2f authored by preetwinder's avatar preetwinder

[erp5_officejs] Fix double links in message and set message to error if get request fails.

parent 50570e4e
......@@ -32,7 +32,6 @@
return new RSVP.Queue()
.push(function () {
console.log('Ajax fetch for get');
console.log(that._default_field_list);
return jIO.util.ajax({
type: "GET",
url: get_post_template.expand({post_id: id,
......@@ -44,6 +43,9 @@
},
function (err) {
console.log('Ajax fetch for get failed', err);
if (err.message) {
return {'message': err.message};
}
});
};
......
......@@ -236,7 +236,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>961.20894.37088.58897</string> </value>
<value> <string>961.22079.38369.25429</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>1502382636.2</float>
<float>1502453744.89</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -25,7 +25,7 @@
param_list[0].select_list.push('link');
return gadget.jio_allDocs(param_list[0])
.push(function (result) {
var i, date, message, len = result.data.total_rows;
var i, date, message, link, len = result.data.total_rows;
for (i = 0; i < len; i += 1) {
if (result.data.rows[i].value.hasOwnProperty("created_time")) {
date = new Date(result.data.rows[i].value.created_time);
......@@ -59,9 +59,9 @@
if (result.data.rows[i].value.story) {
message += ' ' + result.data.rows[i].value.story;
}
var link = result.data.rows[i].value.link;
link = result.data.rows[i].value.link;
if (link) {
if (!(message == link.slice(0, -1) || message == link)) {
if (message.indexOf(link.slice(0, -1)) == -1) {
message += ' ' + result.data.rows[i].value.link.slice(0, 100) + '...';
}
}
......
......@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>1502372527.27</float>
<float>1502451315.0</float>
<string>UTC</string>
</tuple>
</state>
......
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