Skip to content

AO3-7324 List user creations by date, not by pseud#5738

Open
kekley wants to merge 4 commits intootwcode:masterfrom
kekley:AO3-7324
Open

AO3-7324 List user creations by date, not by pseud#5738
kekley wants to merge 4 commits intootwcode:masterfrom
kekley:AO3-7324

Conversation

@kekley
Copy link
Copy Markdown

@kekley kekley commented Apr 17, 2026

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7324

Purpose

List user creations on the spamban page in order from oldest to newest by creation date and then ID, rather than by pseud.

Credit

kekley (they/them)

@sarken
Copy link
Copy Markdown
Collaborator

sarken commented Apr 17, 2026

Hi, kekley!

Thank you so much for this pull request. Someone will be along to review it soon.

If you'd like the ability to comment on, assign, and transition issues in the future, you're welcome to create a Jira account! It makes things a bit easier for us on the organizational side if the Full Name on your Jira account either closely matches the name you'd like us to credit in the release notes or includes it in parentheses, e.g. "Nickname (CREDIT NAME)."

Once you've done that (or if you've already done it -- Jira has been unreliable about showing us new accounts in the admin panel lately), you can either reply here or send an email to otw-coders@transformativeworks.org with your account name and email address and we'll set up the permissions for you.

Thanks again for contributing! If you have any questions, you can contact us at the same email address listed above.

Copy link
Copy Markdown
Member

@brianjaustin brianjaustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 comment, otherwise looking good already!

let!(:user_work) { create(:work, authors: [user.default_pseud]) }
let!(:other_work) { create(:work) }
let!(:other_pseud) { create(:pseud, user: user) }
let!(:older_comment) { create(:comment, pseud: other_pseud) }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than setting the created_at columns below, how about using the travel_to helper when creating the comments? For example:

Suggested change
let!(:older_comment) { create(:comment, pseud: other_pseud) }
let!(:older_comment) do
travel_to(2.days.ago) do
create(:comment, pseud: other_pseud)
end
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and since this won't work after my suggestion: you can create records with a set id with create, just pick something not super low so there is less risk of overlap with things from other tests. E.g.:

let(:user1) { create(:user, id: 10) }
let(:user2) { create(:user, id: 11) }

Comment on lines +25 to +26
@works = @user.works.reorder(created_at: :asc, id: :asc).paginate(page: params[:works_page])
@comments = @user.comments.reorder(created_at: :asc, id: :asc).paginate(page: params[:comments_page])
Copy link
Copy Markdown
Contributor

@Bilka2 Bilka2 Apr 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two additions can be simplified to order(id: :asc)

reorder is only needed if there was previously a different order set on the query, which is not the case here. The issue specifies that the creations should be ordered by id, and since that's unique (so a stable sorting criterion), it can be the only order we specify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants