From 68caf45f33e9fe3d00eacdea5ef7946e12a90223 Mon Sep 17 00:00:00 2001 From: David Sevilla Martin Date: Sat, 8 Aug 2020 16:18:57 -0400 Subject: [PATCH] update: forum/components/NotificationGrid --- js/src/forum/components/NotificationGrid.js | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/js/src/forum/components/NotificationGrid.js b/js/src/forum/components/NotificationGrid.js index e97a6a7d1..e74e4fcc7 100644 --- a/js/src/forum/components/NotificationGrid.js +++ b/js/src/forum/components/NotificationGrid.js @@ -12,7 +12,9 @@ import ItemList from '../../common/utils/ItemList'; * - `user` */ export default class NotificationGrid extends Component { - init() { + oninit(vnode) { + super.oninit(vnode); + /** * Information about the available notification methods. * @@ -36,7 +38,7 @@ export default class NotificationGrid extends Component { } view() { - const preferences = this.props.user.preferences(); + const preferences = this.attrs.user.preferences(); return ( @@ -62,12 +64,12 @@ export default class NotificationGrid extends Component { return ( ); })} @@ -104,7 +106,7 @@ export default class NotificationGrid extends Component { * @param {Array} keys */ toggle(keys) { - const user = this.props.user; + const user = this.attrs.user; const preferences = user.preferences(); const enabled = !preferences[keys[0]]; @@ -128,7 +130,7 @@ export default class NotificationGrid extends Component { * @param {String} method */ toggleMethod(method) { - const keys = this.types.map((type) => this.preferenceKey(type.name, method)).filter((key) => key in this.props.user.preferences()); + const keys = this.types.map((type) => this.preferenceKey(type.name, method)).filter((key) => key in this.attrs.user.preferences()); this.toggle(keys); } @@ -139,7 +141,7 @@ export default class NotificationGrid extends Component { * @param {String} type */ toggleType(type) { - const keys = this.methods.map((method) => this.preferenceKey(type, method.name)).filter((key) => key in this.props.user.preferences()); + const keys = this.methods.map((method) => this.preferenceKey(type, method.name)).filter((key) => key in this.attrs.user.preferences()); this.toggle(keys); }
- {Checkbox.component({ - state: !!preferences[key], - loading: this.loading[key], - disabled: !(key in preferences), - onchange: () => this.toggle([key]), - })} +