Commit fa581f63 authored by preetwinder's avatar preetwinder Committed by preetwinder

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

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