diff --git a/src/js/components/notifications.js b/src/js/components/notifications.js
index c6ee2289b..f422942b5 100644
--- a/src/js/components/notifications.js
+++ b/src/js/components/notifications.js
@@ -18,7 +18,7 @@ var Notifications = React.createClass({
getInitialState: function() {
return {
- notifications: {},
+ notifications: [],
loading: true
};
},
@@ -36,14 +36,7 @@ var Notifications = React.createClass({
var wrapperClass = 'container-fluid main-container notifications';
var self = this;
- if (!_.isEmpty(this.state.notifications)) {
- notifications = (
- _.map(this.state.notifications, function(repo, i) {
- var repoFullName = repo[0].repository.full_name;
- return ;
- })
- );
- } else {
+ if (_.isEmpty(this.state.notifications)) {
wrapperClass += ' all-read';
notifications = (
@@ -52,6 +45,14 @@ var Notifications = React.createClass({
);
+ } else {
+ notifications = (
+ this.state.notifications.map(function(obj, i) {
+ console.log(obj);
+ var repoFullName = obj[0].repository.full_name;
+ return ;
+ })
+ );
}
return (
diff --git a/src/js/components/repository.js b/src/js/components/repository.js
index d0b697a8a..5d84d07c2 100644
--- a/src/js/components/repository.js
+++ b/src/js/components/repository.js
@@ -17,21 +17,17 @@ var Repository = React.createClass({
},
render: function () {
- var notifications = (
- _.map(this.props.repo, function(notification, i) {
- return (
-
- );
- })
- );
-
return (
- {notifications}
+
+ {this.props.repo.map(function(obj, i) {
+ return
;
+ })}
+
);
}
diff --git a/src/js/stores/notifications.js b/src/js/stores/notifications.js
index eb3e0a391..b19c3ea83 100644
--- a/src/js/stores/notifications.js
+++ b/src/js/stores/notifications.js
@@ -10,7 +10,7 @@ var NotificationsStore = Reflux.createStore({
listenables: Actions,
init: function () {
- this._notifications = undefined;
+ this._notifications = [];
},
updateTrayIcon: function (notifications) {
@@ -41,11 +41,16 @@ var NotificationsStore = Reflux.createStore({
onGetNotificationsCompleted: function (notifications) {
var groupedNotifications = _.groupBy(notifications, function(object){
- return object.repository.name;
+ return object.repository.full_name;
});
- this._notifications = groupedNotifications;
- this.trigger(groupedNotifications);
+ var array= [];
+ _.map(groupedNotifications, function(obj, i) {
+ array.push(obj);
+ });
+
+ this._notifications = array;
+ this.trigger(this._notifications);
},
onGetNotificationsFailed: function (error) {