Fetch only last notifications in notifications popover
Related-Bug: #1657348
Depend-On: I7760465f70b3f69791e7a0c558a26e8ba55c934a
Change-Id: I257cf6c9278743f7b7789b4d818bed8be9958cde
(cherry picked from commit 2044d32c67
)
This commit is contained in:
parent
2fb9547a43
commit
3fa2b9c411
|
@ -310,10 +310,13 @@ var NotificationsPopover = React.createClass({
|
|||
this.updateNotifications();
|
||||
},
|
||||
updateNotifications() {
|
||||
var {notifications} = this.props;
|
||||
//FIXME(jkirnosova): need to fetch limited number of notifications
|
||||
//according to visibleNotificationsNumber prop
|
||||
return notifications.fetch().then(() => this.markAsRead());
|
||||
var {notifications, visibleNotificationsNumber} = this.props;
|
||||
return notifications
|
||||
.fetch({
|
||||
url: _.result(notifications, 'url') + '/?' +
|
||||
$.param({limit: visibleNotificationsNumber, order_by: '-id'})
|
||||
})
|
||||
.then(() => this.markAsRead());
|
||||
},
|
||||
showNodeInfo(id) {
|
||||
this.props.toggle(false);
|
||||
|
@ -376,7 +379,7 @@ var NotificationsPopover = React.createClass({
|
|||
},
|
||||
render() {
|
||||
var {loading} = this.state;
|
||||
var {notifications, visibleNotificationsNumber} = this.props;
|
||||
var {notifications} = this.props;
|
||||
var showMore = Backbone.history.getHash() !== 'notifications';
|
||||
return (
|
||||
<Popover {...this.props} className='notifications-popover'>
|
||||
|
@ -384,7 +387,7 @@ var NotificationsPopover = React.createClass({
|
|||
<ProgressBar />
|
||||
:
|
||||
<div>
|
||||
{_.map(notifications.take(visibleNotificationsNumber), this.renderNotification)}
|
||||
{notifications.map(this.renderNotification)}
|
||||
{showMore &&
|
||||
<div className='show-more'>
|
||||
<a href='#notifications'>{i18n('notifications_popover.view_all_button')}</a>
|
||||
|
|
Loading…
Reference in New Issue