[Flags] Optimization needed while handling large amounts of unattended flags
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
## Bug Report
This is not a bug maybe we can call it an enhancement/optimization
**Current Behavior**
A clear and concise description of the behaviour.
i have almost 920 yet approve posts, when I hit the flag icon it's loading slowly 😅 is there any way to load it fastly? any better way to optimize it? I'm using Redis (sessions, cache, queue)
The flags extension loads all the flags and returns them, it assumes there can't be a situation where we could end up with such a crazy amount of unattended flags.
**Steps to Reproduce**
make 1000 unapproved posts :)
**Expected Behavior**
i have almost 920 yet approve posts, when I hit the flag icon it's loading slowly
**Environment**
- Flarum version: 1.0.4
- Website URL: N/A
- Webserver: [apache]
- Hosting environment: [vps]
- PHP version: 7.4
- Browser: [chrome]
**Possible Solution**
as it'd be better to paginate like the notifications, despite the fact that admins shouldn't normally have such a high number of flags.
https://discuss.flarum.org/d/28570-loading-issue-with-flags-920-pending-posts

Contributor guide
Research direction
Start with the flags extension's loading path and compare it with the pagination used by notifications. Review the linked discussion for the intended behavior and constraints around roughly 1,000 unattended flags. Done means the flag view loads incrementally rather than retrieving every flag at once, while preserving the existing approval workflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, redis
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100