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

Improve Organisation select on /users/invitation/new #2426

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

chrislo
Copy link
Contributor

@chrislo chrislo commented Oct 11, 2023

Trello: https://trello.com/c/R9bKDyi5

Rosa got in touch to say that this Organisation select box is not very usable, particularly in integration. The organisations are sorted in a seemingly random order and they include closed organisations that we never need to assign to new users.

This commit fixes both of those issues.

The previous tests stubbed policy_scope which is a Pundit-provided convenience for Pundit.policy_scope automatically passing in current_user as the first argument. I wanted to actually call the scope, so I could test that the not_closed and order scopes I've added were working correctly. To get policy_scope to work in the isolated tests I've explicitly included Pundit::Authorization in UsersHelper and stubbed current_user instead.

Rosa got in touch to say that this Organisation select box is not very
usable, particularly in integration. The organisations are sorted in a
seemingly random order and they include closed organisations that we
never need to assign to new users.

This commit fixes both of those issues.

The previous tests stubbed `policy_scope` which is a Pundit-provided
convenience for `Pundit.policy_scope` automatically passing in
`current_user` as the first argument. I wanted to actually call the
scope, so I could test that the `not_closed` and `order` scopes I've
added were working correctly. To get `policy_scope` to work in the
isolated tests I've explicitly included `Pundit::Authorization` in
`UsersHelper` and stubbed `current_user` instead.
@chrislo chrislo force-pushed the improve-organisation-select-on-user-invite-page branch from 9024924 to 47e466e Compare October 11, 2023 09:08
@floehopper floehopper self-requested a review October 11, 2023 09:19
@floehopper floehopper self-assigned this Oct 11, 2023
Copy link
Contributor

@floehopper floehopper left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@chrislo chrislo merged commit dd376e4 into main Oct 11, 2023
6 checks passed
@chrislo chrislo deleted the improve-organisation-select-on-user-invite-page branch October 11, 2023 09:27
chrislo added a commit that referenced this pull request Oct 11, 2023
This makes it easier to select the organisation for a batch of users
by excluding closed organisations and sorting the remaining ones
alphabetically. We did something similar in #2426 and #2417 - there's
enough subtle differences in those two select boxes (indicating a
current organisation and adding a "None" option respectively) that I
haven't attempted to extract the duplication. I think the new scopes
are self-explanatory enough that I'm happy to keep them inline in this
view.
chrislo added a commit that referenced this pull request Oct 11, 2023
This makes it easier to select the organisation for a batch of users
by excluding closed organisations and sorting the remaining ones
alphabetically. We did something similar in #2426 and #2417 - there's
enough subtle differences in those two select boxes (indicating a
current organisation and adding a "None" option respectively) that I
haven't attempted to extract the duplication. I think the new scopes
are self-explanatory enough that I'm happy to keep them inline in this
view.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants