Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AO3-5901 Pseud switcher text on the New Pseud page #4579

Merged
merged 5 commits into from
Jul 16, 2023

Conversation

neuroalien
Copy link
Contributor

Pull Request Checklist

Issue

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

Purpose

What does this PR do?

Provides fallback text for the edge case of the New Pseud page, where @pseud is defined, but doesn't have a name yet.

Testing Instructions

How can the Archive's QA team verify that this is working as you intended?

If you have a Jira account with access, please update or comment on the issue
with any new or missing testing instructions instead.

References

Are there other relevant issues/pull requests/mailing list discussions?

Credit

What name and pronouns should we use to credit you in the Archive of Our Own's Release Notes?

If you have a Jira account, please include the same name in the "Full name"
field on your Jira profile, so we can assign you the issues you're working on.

Please note that if you do not fill in this section, we will use your GitHub account name and
they/them pronouns.

Provide fallback text for the edge case of the New Pseud page, where `@pseud` is defined, but doesn't have a `name` yet.
@sarken sarken added the Priority: High - Broken on Test Merge immediately after approval label Jul 15, 2023
@neuroalien
Copy link
Contributor Author

@sarken The reason the test suite fails is that the current pseud is no longer guaranteed to show up in the pseud switcher. Are we ok with that?

When we started limiting the number of pseuds in the sidebar, the way to guarantee that the current pseud would show up in the sidebar was to show it at the top of the pseud switcher.

However, [AO3-6249](https://otwarchive.atlassian.net/browse/AO3-6249) decided that the pseud switcher should always say "Pseuds" at the top.

We broke this behaviour in otwcode#4554.

Fixing it in c3e4ab9 resulted in the current pseud not showing in the sidebar in some conditions.

Move or add the current pseud at the beginning of the list, whether or not it is present in the abbreviated list.

We are aware that this could make the abbreviated list in the pseud switcher show `ITEMS_PER_PAGE` + 1 pseuds in some cases, discuss with @sarken if you disagree.
The Hound has arisen from its slumber as soon as I touched some ancient scrolls, and so I've tried to appease it with the following sacrifices:
- add spaces after and before curly bois (`{` and `}`)
- IN-TER-PO-LATE! IN-TER-PO-LATE! (AKA prefer interpolation to string concatenation)
- stop using instance vars in helper method

The latter change has morally forced my hand to:
-  separate the method that determines which pseuds to show in the sidebar selector from the method that outputs the HTML
- remove the `print_` prefix from the method that I touched, as [per precedent](50f7b7e)
This method has had no callers since otwcode@c10ef8a#diff-638a702b43ccba6b5dcb42edd2c6f8bb4ba56c492cb2ef7ccf56815663743e07.

Tacking it onto this issue because its presence confused me when deciding whether the `pseuds_for_sidebar` method belonged in the user helper or the pseud helper.
pseuds -= [@pseud] if @pseud && @pseud.new_record?
list = pseuds.sort.collect {|pseud| "<li>" + span_if_current(pseud.name, [pseud.user, pseud]) + "</li>"}.join("").html_safe
def pseud_selector(pseuds)
pseuds.collect { |pseud| "<li>#{span_if_current(pseud.name, [pseud.user, pseud])}</li>" }.join.html_safe
Copy link

Choose a reason for hiding this comment

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

[Correctable] Layout/SingleLineBlockChain: Put method call on a separate line if chained to a single line block.

Copy link
Collaborator

@sarken sarken left a comment

Choose a reason for hiding this comment

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

Thank you! At some point in the future, we can discuss changing the should-always-say-Pseuds behavior introduced in AO3-6249. This will get us through until then.

@sarken sarken merged commit d997475 into otwcode:master Jul 16, 2023
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.

2 participants