Fetch only last notifications in notifications popover
Related-Bug: #1657348 Depend-On: I7760465f70b3f69791e7a0c558a26e8ba55c934a Change-Id: I257cf6c9278743f7b7789b4d818bed8be9958cde
This commit is contained in:
parent
b81ee34324
commit
2044d32c67
|
@ -312,10 +312,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);
|
||||
|
@ -375,7 +378,7 @@ var NotificationsPopover = React.createClass({
|
|||
},
|
||||
render() {
|
||||
var {loading} = this.state;
|
||||
var {notifications, toggle, visibleNotificationsNumber} = this.props;
|
||||
var {notifications, toggle} = this.props;
|
||||
var showMore = Backbone.history.getHash() !== 'notifications';
|
||||
return (
|
||||
<Popover toggle={toggle} className='notifications-popover'>
|
||||
|
@ -383,7 +386,7 @@ var NotificationsPopover = React.createClass({
|
|||
<ProgressBar />
|
||||
:
|
||||
<div>
|
||||
{notifications.take(visibleNotificationsNumber).map(this.renderNotification)}
|
||||
{notifications.map(this.renderNotification)}
|
||||
{showMore &&
|
||||
<div className='show-more'>
|
||||
<Link to='/notifications'>{i18n('notifications_popover.view_all_button')}</Link>
|
||||
|
|
Loading…
Reference in New Issue