import UserPage from './UserPage';
import DiscussionList from './DiscussionList';
import DiscussionListState from '../states/DiscussionListState';

/**
 * The `DiscussionsUserPage` component shows a discussion list inside of a user
 * page.
 */
export default class DiscussionsUserPage extends UserPage {
  oninit(vnode) {
    super.oninit(vnode);

    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({ state: this.state })}</div>;
  }
}

@@ -484,22 +484,25 @@
     
-q: '
+filter: %7B 
 author:
-' +
  use
@@ -513,16 +513,18 @@
 ername()
+ %7D
 ,%0A      

Use `author` filter parameter instead of `q` with gambit to get a user's discussions on the `DiscussionsUserPage` (#3068)