Browse code

BM-11683 Fix: invitations list

David Phan authored on 22/06/2017 10:00:47
Showing 1 changed files
... ...
@@ -125,16 +125,18 @@ net.bluemind.calendar.list.PendingEventsPresenter.prototype.setup = function() {
125 125
 
126 126
     }, this);
127 127
     this.actions_.setCalendars(data.calendars);
128
-    data.events = [];
129 128
     var futures = goog.array.map(data.calendars, function(calendar) {
130 129
       return this.ctx.service('pendingEventsMgmt').getPendingEvents(calendar.container).then(function(series) {
131
-        data.events = goog.array.flatten(goog.array.map(series, function(vseries) {
130
+        return goog.array.flatten(goog.array.map(series, function(vseries) {
132 131
           return this.vseriesToMV_(vseries, calendar);
133 132
         }, this));
134 133
       }, null, this);
135 134
     }, this);
136 135
     return goog.Promise.all(futures);
137
-  }, null, this).then(function() {
136
+  }, null, this).then(function(results) {
137
+
138
+    data.events = goog.array.flatten(results);
139
+
138 140
     if (data.events.length == 0) {
139 141
       this.ctx.helper('url').redirect('/', true);
140 142
     } else {