diff --git a/js/src/forum/components/UserPoliciesStateModal.js b/js/src/forum/components/UserPoliciesStateModal.js index 3aac9a8..d602f26 100644 --- a/js/src/forum/components/UserPoliciesStateModal.js +++ b/js/src/forum/components/UserPoliciesStateModal.js @@ -2,10 +2,29 @@ import app from 'flarum/forum/app'; import humanTime from 'flarum/common/helpers/humanTime'; import Modal from 'flarum/common/components/Modal'; import sortByAttribute from '../../common/helpers/sortByAttribute'; +import LoadingIndicator from 'flarum/common/components/LoadingIndicator'; /* global m */ export default class UserPoliciesStateModal extends Modal { + user = null; + loading = false; + + oninit(vnode) { + super.oninit(vnode); + + if (this.attrs.user.fofTermsPoliciesState() === undefined) { + this.loading = true; + app.store.find('users', this.attrs.user.id()).then((user) => { + this.user = user; + this.loading = false; + m.redraw(); + }); + } else { + this.user = this.attrs.user; + } + } + title() { return app.translator.trans('fof-terms.forum.state-modal.title', { username: this.attrs.user.username(), @@ -13,12 +32,20 @@ export default class UserPoliciesStateModal extends Modal { } content() { + if (this.loading) { + return ( +