mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 21:11:55 +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'));
|
||||
}
|
||||
|
||||
content() {
|
||||
return (
|
||||
<div className="DiscussionsUserPage">
|
||||
{DiscussionList.component({
|
||||
params: {
|
||||
q: 'author:' + this.user.username(),
|
||||
show(user) {
|
||||
super.show(user);
|
||||
|
||||
this.state = new DiscussionListState({
|
||||
q: 'author:' + user.username(),
|
||||
sort: 'newest',
|
||||
},
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
||||
this.state.refresh();
|
||||
}
|
||||
|
||||
content() {
|
||||
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