notifications popup menu should use functions from regular notification object.

This commit is contained in:
Steven Fuchs 2011-12-23 23:01:18 -05:00
parent 02531337cb
commit 95b553f953

View file

@ -63,6 +63,7 @@
$.each(notifications, function(index, notification) {
var notificationElement = $("<div/>")
.addClass("notification_element")
.data( "guid", notification.id )
.html(notification.translation)
.prepend($("<img/>", { src: notification.actors[0].avatar }))
.append("<br />")
@ -73,16 +74,18 @@
.appendTo(self.dropdownNotifications);
notificationElement.find("abbr.timeago").timeago();
notificationElement.click(Diaspora.page.header.notifications.messageClick);
if(notification.unread) {
notificationElement.addClass("unread");
$.ajax({
url: "/notifications/" + notification.id,
type: "PUT",
success: function() {
Diaspora.page.header.notifications.decrementCount();
}
data: { unread: false },
success: Diaspora.page.header.notifications.clickSuccess
});
} else {
notificationElement.addClass("read");
}
});
});