From c74b3434e75b57eb7f40c32b787cb45a680ed336 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 4 Aug 2015 21:22:22 +0930 Subject: [PATCH] Refactor notification list loading So that notifications are reloaded (if needed) every time the notifications dropdown button is clicked --- js/forum/src/components/NotificationList.js | 2 -- js/forum/src/components/NotificationsDropdown.js | 5 ++++- js/forum/src/components/NotificationsPage.js | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/js/forum/src/components/NotificationList.js b/js/forum/src/components/NotificationList.js index fae4c430a..0b1b96679 100644 --- a/js/forum/src/components/NotificationList.js +++ b/js/forum/src/components/NotificationList.js @@ -18,8 +18,6 @@ export default class NotificationList extends Component { * @type {Boolean} */ this.loading = false; - - this.load(); } view() { diff --git a/js/forum/src/components/NotificationsDropdown.js b/js/forum/src/components/NotificationsDropdown.js index d009e7fe8..03fdefbfd 100644 --- a/js/forum/src/components/NotificationsDropdown.js +++ b/js/forum/src/components/NotificationsDropdown.js @@ -12,6 +12,8 @@ export default class NotificationsDropdown extends Component { * @type {Boolean} */ this.showing = false; + + this.list = new NotificationList(); } view() { @@ -28,7 +30,7 @@ export default class NotificationsDropdown extends Component { {app.trans('core.notifications')}
- {this.showing ? NotificationList.component() : ''} + {this.showing ? this.list.render() : ''}
); @@ -39,6 +41,7 @@ export default class NotificationsDropdown extends Component { m.route(app.route('notifications')); } else { this.showing = true; + this.list.load(); } } diff --git a/js/forum/src/components/NotificationsPage.js b/js/forum/src/components/NotificationsPage.js index dc7ea02d8..71a77f12a 100644 --- a/js/forum/src/components/NotificationsPage.js +++ b/js/forum/src/components/NotificationsPage.js @@ -13,9 +13,12 @@ export default class NotificationsPage extends Component { app.history.push('notifications'); app.drawer.hide(); app.modal.close(); + + this.list = new NotificationList(); + this.list.load(); } view() { - return
{NotificationList.component()}
; + return
{this.list.render()}
; } }