do not crash on status: null
This commit is contained in:
parent
d67a4c224e
commit
39e8a9f796
1 changed files with 13 additions and 0 deletions
|
@ -60,6 +60,7 @@ WorkerScript.onMessage = function(msg) {
|
||||||
} else if(msg.action === "notifications") {
|
} else if(msg.action === "notifications") {
|
||||||
// notification
|
// notification
|
||||||
//console.log("Is notification... parsing...")
|
//console.log("Is notification... parsing...")
|
||||||
|
console.log(JSON.stringify(data[i]))
|
||||||
item = parseNotification(data[i]);
|
item = parseNotification(data[i]);
|
||||||
items.push(item)
|
items.push(item)
|
||||||
|
|
||||||
|
@ -148,12 +149,20 @@ function parseNotification(data){
|
||||||
};
|
};
|
||||||
switch (item['type']){
|
switch (item['type']){
|
||||||
case "mention":
|
case "mention":
|
||||||
|
if (!data.status) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
item = parseToot(data.status)
|
item = parseToot(data.status)
|
||||||
item['typeIcon'] = "image://theme/icon-s-retweet"
|
item['typeIcon'] = "image://theme/icon-s-retweet"
|
||||||
item['typeIcon'] = "image://theme/icon-s-alarm"
|
item['typeIcon'] = "image://theme/icon-s-alarm"
|
||||||
item['type'] = "mention";
|
item['type'] = "mention";
|
||||||
break;
|
break;
|
||||||
case "reblog":
|
case "reblog":
|
||||||
|
if (!data.status) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
item = parseToot(data.status)
|
item = parseToot(data.status)
|
||||||
item = parseAccounts(item, "reblog_", data["account"])
|
item = parseAccounts(item, "reblog_", data["account"])
|
||||||
item = parseAccounts(item, "", data["status"]["account"])
|
item = parseAccounts(item, "", data["status"]["account"])
|
||||||
|
@ -162,6 +171,10 @@ function parseNotification(data){
|
||||||
item['typeIcon'] = "image://theme/icon-s-retweet"
|
item['typeIcon'] = "image://theme/icon-s-retweet"
|
||||||
break;
|
break;
|
||||||
case "favourite":
|
case "favourite":
|
||||||
|
if (!data.status) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
item = parseToot(data.status)
|
item = parseToot(data.status)
|
||||||
item = parseAccounts(item, "reblog_", data["account"])
|
item = parseAccounts(item, "reblog_", data["account"])
|
||||||
item = parseAccounts(item, "", data["status"]["account"])
|
item = parseAccounts(item, "", data["status"]["account"])
|
||||||
|
|
Loading…
Reference in a new issue