Don t parse XML formated notifications (#2087)

This commit is contained in:
Christophe Maudoux 2020-02-05 22:07:54 +01:00
parent 1cd6f82f80
commit ebc4a550d4
6 changed files with 24 additions and 15 deletions

View File

@ -206,11 +206,15 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
reference: node.reference
condition: node.condition
if $scope.type == 'actives'
notif = JSON.parse response.data.notifications
$scope.currentNotification.text = notif.text
$scope.currentNotification.title = notif.title
$scope.currentNotification.subtitle = notif.subtitle
$scope.currentNotification.notifications = response.data.notifications
try
console.log "Try to parse a JSON formated notification..."
notif = JSON.parse response.data.notifications
$scope.currentNotification.text = notif.text
$scope.currentNotification.title = notif.title
$scope.currentNotification.subtitle = notif.subtitle
catch e
console.log "Unable to parse JSON"
$scope.currentNotification.notifications = response.data.notifications
else
$scope.currentNotification.done = response.data.done
$scope.waiting = false

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -232,17 +232,23 @@
notificationId = node.uid + "_" + node.reference;
}
$http.get(scriptname + "notifications/" + $scope.type + "/" + notificationId).then(function(response) {
var notif;
var e, notif;
$scope.currentNotification = {
uid: node.uid,
reference: node.reference,
condition: node.condition
};
if ($scope.type === 'actives') {
notif = JSON.parse(response.data.notifications);
$scope.currentNotification.text = notif.text;
$scope.currentNotification.title = notif.title;
$scope.currentNotification.subtitle = notif.subtitle;
try {
console.log("Try to parse a JSON formated notification...");
notif = JSON.parse(response.data.notifications);
$scope.currentNotification.text = notif.text;
$scope.currentNotification.title = notif.title;
$scope.currentNotification.subtitle = notif.subtitle;
} catch (error) {
e = error;
console.log("Unable to parse JSON");
}
$scope.currentNotification.notifications = response.data.notifications;
} else {
$scope.currentNotification.done = response.data.done;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long