Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Commit

Permalink
MUMUP-2875 Fixes bug with dataObject in notification feed caused it t…
Browse files Browse the repository at this point in the history
…o not display (#387)

* MUMUP-2875 Fixes bug with dataObject in notification feed caused it to not display

* Adds missing semicolon
  • Loading branch information
vertein authored Mar 30, 2017
1 parent bf6e3d8 commit c4397da
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
16 changes: 8 additions & 8 deletions uw-frame-components/portal/notifications/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ define(['angular', 'jquery'], function(angular, $) {
return;
}
var arrayFilter = angular.fromJson(notification.dataArrayFilter);
objectToFind = $filter('filter')(objectToFind, arrayFilter);
}

//If the data object is there, we have a match
if (objectToFind && objectToFind.length > 0) {
if ($filter('filter')(objectToFind, arrayFilter).length > 0) {
return notification;
}
} else if (objectToFind) {
return notification;
}else{
return;
}
}

return;

}).catch (function(reason){
$log.warn("Error retrieving data for notification");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,5 +510,39 @@ define(['angular-mocks', 'portal'], function() {
httpBackend.flush();
});

it("notification should appear when dataObject is present and not an array", function(){
//setup
httpBackend.whenGET(backendURL).respond(
{"notifications" :
[
{
"id" : 1,
"groups" : ["Everyone"],
"title" : "Notification 1",
"actionURL" : "http://www.google.com",
"actionAlt" : "Google"
},
{
"id" : 2,
"groups" : ["Everyone"],
"title" : "Notification 2",
"actionURL" : "http://www.google.com",
"actionAlt" : "Google",
"dataURL" : "http://www.google.com",
"dataObject" : "id"
}
]
}
);
httpBackend.whenGET(groupURL).respond({"groups" :[{"name" : "Everyone"}]});
httpBackend.whenGET("http://www.google.com").respond(200, {"name":"foo" , "id":"bar" , "favorite food":"baz"});
httpBackend.whenGET(kvURL + "/" + kvKeys.DISMISSED_NOTIFICATION_IDS).respond([]);
notificationsService.getFilteredNotifications().then(function(results){
expect(results).toBeTruthy();
expect(results.notDismissed.length).toEqual(2);
});
httpBackend.flush();
});

});
});

0 comments on commit c4397da

Please sign in to comment.