mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 07:27:09 +08:00
Selectively construct request params
This commit is contained in:
parent
5687840580
commit
5bf441ca55
@ -85,14 +85,12 @@ export default class DiscussionList extends Component {
|
||||
* @api
|
||||
*/
|
||||
requestParams() {
|
||||
const params = Object.assign({include: ['startUser', 'lastUser']}, this.props.params);
|
||||
const params = {include: ['startUser', 'lastUser'], filter: {}};
|
||||
|
||||
params.sort = this.sortMap()[params.sort];
|
||||
params.sort = this.sortMap()[this.props.params.sort];
|
||||
|
||||
if (params.q) {
|
||||
params.filter = params.filter || {};
|
||||
params.filter.q = params.q;
|
||||
delete params.q;
|
||||
if (this.props.params.q) {
|
||||
params.filter.q = this.props.params.q;
|
||||
|
||||
params.include.push('relevantPosts', 'relevantPosts.discussion', 'relevantPosts.user');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user