Closed Danter3 closed 10 months ago
The max limit is set to 50 by default. But you should be able to override this for the given controller using an extender.
How to extend this max limit:
https://docs.flarum.org/extend/api#extending-api-controllers
This solution solves your issue, if you need further help feel free to post on discuss at https://discuss.flarum.org
@luceos it's actually not possible to override the frontend side limit, which is hard coded to 20 per page in the request. As far as I can tell. So the backend one doesn't have an effect as it's just a maximum.
The relevant code is in DiscussionListState
and PaginatedListState
.
@luceos it's actually not possible to override the frontend side limit, which is hard coded to 20 per page in the request. As far as I can tell. So the backend one doesn't have an effect as it's just a maximum.
The relevant code is in
DiscussionListState
andPaginatedListState
.
It would make more sense then to modify core so that only the backend restrictions apply; like carrying that value from the backend into the frontend for re-use?
Hi there, this sounds like an issue I can help solve, could I please be assigned? thankyou
I didn't see this before, @SychO9 it's great that you've taken on this task. I had created a somewhat convoluted solution and it was causing issues with the no-js view.
If I understand correctly, can this now simply be managed from the extend.php at the root?
@Danter3 yes. Using the ApiController::setLimit
extender on the appropriate controller.
But this is a 2.0 change (that's the current active branch), so it will be a while before it's available.
Current Behavior
Hi, I'm trying to create a super minimal Hacker News theme for Flarum and I'm running into a problem when it comes to extending the number of discussions per page in the index.
Steps to Reproduce
This problem I think should be considered a bug, I think it is a major flaw when creating themes like this or just trying to change the number of discussions, my intention is to show around 50 discussions per page in the index (currently only 20 does not even enable page scrolling and looks very weird), and I can't find a way to do this without using hacky forms with js, the current limit of 20 discussions is hard coded and also linked to the number currently used within the discussions with the posts, which doesn't make sense as it would be advisable to keep different values.
Expected Behavior
I think for something so basic there should be a simple method that allows to change the values of the discussions shown per page and separately also the posts per page within the discussions, definitely with js I have tried it seems to be achievable but I do not feel that it is the right thing to do....
Screenshots
No response
Environment
Output of
php flarum info
Possible Solution
No response
Additional Context
No response