do not crash on status: null

This commit is contained in:
Ales Katona 2019-07-25 21:07:49 -06:00
parent d67a4c224e
commit 39e8a9f796
No known key found for this signature in database
GPG key ID: 08C459E2D8ABB7E8

View file

@ -60,6 +60,7 @@ WorkerScript.onMessage = function(msg) {
} else if(msg.action === "notifications") {
// notification
//console.log("Is notification... parsing...")
console.log(JSON.stringify(data[i]))
item = parseNotification(data[i]);
items.push(item)
@ -148,12 +149,20 @@ function parseNotification(data){
};
switch (item['type']){
case "mention":
if (!data.status) {
break;
}
item = parseToot(data.status)
item['typeIcon'] = "image://theme/icon-s-retweet"
item['typeIcon'] = "image://theme/icon-s-alarm"
item['type'] = "mention";
break;
case "reblog":
if (!data.status) {
break;
}
item = parseToot(data.status)
item = parseAccounts(item, "reblog_", data["account"])
item = parseAccounts(item, "", data["status"]["account"])
@ -162,6 +171,10 @@ function parseNotification(data){
item['typeIcon'] = "image://theme/icon-s-retweet"
break;
case "favourite":
if (!data.status) {
break;
}
item = parseToot(data.status)
item = parseAccounts(item, "reblog_", data["account"])
item = parseAccounts(item, "", data["status"]["account"])