mirror of
https://github.com/flarum/framework.git
synced 2024-11-26 10:14:16 +08:00
Fix discussions user page (#2225)
* Fixed up discussions user page, improve discussion list state signature
This commit is contained in:
parent
90dd8f60a5
commit
56b6e85255
|
@ -84,7 +84,7 @@ export default class ForumApplication extends Application {
|
|||
*
|
||||
* @type {DiscussionListState}
|
||||
*/
|
||||
this.discussions = new DiscussionListState({ forumApp: this });
|
||||
this.discussions = new DiscussionListState({}, this);
|
||||
|
||||
/**
|
||||
* @deprecated beta 14, remove in beta 15.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import UserPage from './UserPage';
|
||||
import DiscussionList from './DiscussionList';
|
||||
import DiscussionListState from '../states/DiscussionListState';
|
||||
|
||||
/**
|
||||
* The `DiscussionsUserPage` component shows a discussion list inside of a user
|
||||
|
@ -12,16 +13,18 @@ export default class DiscussionsUserPage extends UserPage {
|
|||
this.loadUser(m.route.param('username'));
|
||||
}
|
||||
|
||||
show(user) {
|
||||
super.show(user);
|
||||
|
||||
this.state = new DiscussionListState({
|
||||
q: 'author:' + user.username(),
|
||||
sort: 'newest',
|
||||
});
|
||||
|
||||
this.state.refresh();
|
||||
}
|
||||
|
||||
content() {
|
||||
return (
|
||||
<div className="DiscussionsUserPage">
|
||||
{DiscussionList.component({
|
||||
params: {
|
||||
q: 'author:' + this.user.username(),
|
||||
sort: 'newest',
|
||||
},
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
return <div className="DiscussionsUserPage">{DiscussionList.component({ state: this.state })}</div>;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
export default class DiscussionListState {
|
||||
constructor({ params = {}, forumApp = app } = {}) {
|
||||
constructor(params = {}, app = window.app) {
|
||||
this.params = params;
|
||||
|
||||
this.app = forumApp;
|
||||
this.app = app;
|
||||
|
||||
this.discussions = [];
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user