AO3-3764 Paginate tag set nominations review page#5752
AO3-3764 Paginate tag set nominations review page#5752sarken merged 11 commits intootwcode:masterfrom
Conversation
11f0ab0 to
0bb47cc
Compare
| <%= check_all_none("Approve All", "Approve None", "approve") %> | ||
| <% if @paginations&.dig(tag_type) %> | ||
| <%== pagy_nav(@paginations[tag_type], | ||
| anchor_string: "id=\"#{tag_type}_nominations\"") %> |
There was a problem hiding this comment.
Question! Does the anchor_string here mean that the pagination links should be like ?fandom_page=3#fandom_nominations?
I swear I saw that behavior when I first pulled this code to try it out, but it has disappeared on me, so I'm confused. 😆
There was a problem hiding this comment.
Yes, that's the intended behavior! The anchor_string parameter name is a bit misleading, it refers to the HTML anchor element ( tag) not URL anchors/fragments. I've pushed a fix using the correct fragment parameter.
Good catch! Thanks!
sarken
left a comment
There was a problem hiding this comment.
Just a couple of nitpicks/questions about the tests! Aside from that, this looks good and I'm excited. 🎉
30a6564 to
fd23efc
Compare
| it "page 3 returns the remaining unique tagnames" do | ||
| get :index, params: { tag_set_id: owned_tag_set.id, fandom_page: 3 } | ||
| page3_tagnames = assigns(:nominations)[:fandom].map(&:tagname) | ||
|
|
||
| expect(page3_tagnames.length).to eq(noms_per_page) | ||
| expect(page3_tagnames).to eq(page3_tagnames.uniq) | ||
| end |
There was a problem hiding this comment.
I might be missing something here. How does this tell us these are definitely the unique tagnames for page 3 and not the same tags from page 1 or 2? (It's okay if it doesn't. In my opinion, we can remove it instead of expanding it, since the test above already demonstrates the tagnames are unique. If we do that, it might also mean we can go from noms_per_page * 3 to 2.)
There was a problem hiding this comment.
Make sense, 2 pages is enough to validate what we need.
647f9b8 to
14f07c9
Compare
Pull Request Checklist
as the first thing in your pull request title (e.g.
AO3-1234 Fix thing)until they are reviewed and merged before creating new pull requests.
Issue
https://otwarchive.atlassian.net/browse/AO3-3764
Purpose
When a tag set has more than 30 unreviewed nominations, moderators currently see a random subset with the message "There are too many nominations to show at once." This makes it impossible to systematically review all nominations.
This PR replaces the random selection with proper pagination using pagy:
created_atascending for deterministic resultsTesting Instructions
Credit
Pablo Monfort (he/him)