Do not count stars of blocked users
What does this MR do and why?
Today stars of blocked users are counted as well, this MR changes this to only count stars of active users.
counter_cache
does not support conditions so I added an alias_method
for star_count
.
https://github.com/magnusvk/counter_culture could be another option to achieve this and avoid N+1 queries.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
- Impersonate 3 different users on GDK and star e.g., https://127.0.0.1:3000/gitlab-org/gitlab-test
- Star count on https://127.0.0.1:3000/gitlab-org/gitlab-test is 3
- Block one of the users, star count is 2 instead of 3 as without this change
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Roger Meier