Fixes T6595. This diff has two issues as is... 1) the differential data fetching is pretty cheesey, but it looks like we can't just issue three separate databases to get the right data? 2) the translations break, since I am turning this into a string (and not an int) so the whole pluralization bit fails. I think 1 is okay as is and 2 needs to be fixed though I am not sure how to best do that...
Details
- Reviewers
epriestley - Maniphest Tasks
- T6595: Limit homepage application status badge queries
- Commits
- Restricted Diffusion Commit
rP2b99b4add8ae: Home - limit "status" queries to 100 and show 99+ if we hit that
loaded home page and it looked nice...!
Diff Detail
- Repository
- rP Phabricator
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Oh, yuck. In theory, I think the translations have to go like this, ideally:
if ($count >= LIMIT) { $text = pht('99+ Things'); } else { $text = pht('%s Thing(s)', new PhutilNumber($count)); }
You could also do this:
$text = pht('(%d) %s Thing(s)', new PhutilNumber($count), $formatted_count);
...then translate it as just '%$2s Thing', '%$2s Thing(s)' -- i.e., discard the number in the output text. But this would be trickier for translators, and if there are any languages which have a noun form for "uncountably many things" or "a huge number of things" or similar, they wouldn't be able to use it with that approach. (I don't know if any such languages exist.)
src/applications/differential/application/PhabricatorDifferentialApplication.php | ||
---|---|---|
104 | Maybe just do MAX_STATUS_ITEMS, and then if we hit the limit just render a single "99+ Active Reviews" bucket instead of breaking it up? I don't think the individual counts are too likely to be useful once you have 100+ of them, but I'm hesitant about showing an invalid number. |
- fix string construction, using a '%s things' if we hit limit and a '%d thing(s)' if we don't
- provide two more translations that were shown missing in testing
- refine differential to just say 'LIMIT-1+ Active Reviews' if we hit the limit there, else standard bucketing stuff