Skip to content

Organizations: Organization chooser page #10325

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

Merged
merged 19 commits into from
May 25, 2023
Merged

Conversation

benjaoming
Copy link
Contributor

@benjaoming benjaoming commented May 18, 2023

Fixes https://github.com/readthedocs/readthedocs-corporate/issues/938

If the user has exactly 1 organization, the organization chooser will automatically redirect to the requested page with the slug path argument replaced with the slug of the user's single organization.

If the user has >1 or zero organizations, visiting the organization chooser displays a list of the requested view name with URLs for each organization's slug. Notice how the organization chooser page takes the urlconf name as a URL parameter next_name. It can also handle next_querystring.

image

TODO

  • Check up on URL path kwargs and ensure they are included if relevant. UPDATE: kwargs in URL paths are incompatible with unspecific URLs, so we just raise a 404 and log a warning.
  • Write tests
  • Remove generic URL scheme

Removed

This PR is no longer titled "Support URL scheme for unspecific organization w/ chooser page or automatic redirect"

This change allows URLs to be specified without knowledge of an organization's slug, moreover in cases where a user has more than 1 organization.

Allowing such URLs means easy reuse of email templates.

A reusable URL for organization-specific pages uses - as the slug.

The URL for different organization pages look like this:

  • Organization detail: devthedocs.com/organizations/-/
  • Members admin: devthedocs.com/organizations/-/members/
  • Subscription page: devthedocs.com/organizations/-/subscription/

@benjaoming benjaoming changed the title Initial work for an all-purporse URL scheme for organization-specific pages All-purporse URL scheme for organization-specific pages May 22, 2023
@benjaoming benjaoming changed the title All-purporse URL scheme for organization-specific pages Organizations: Support URL scheme for unspecific organization w/ chooser page or automatic redirect May 22, 2023
@benjaoming
Copy link
Contributor Author

Writing some more test cases but almost done...

@benjaoming
Copy link
Contributor Author

Added more testing.

@benjaoming benjaoming marked this pull request as ready for review May 22, 2023 22:09
@benjaoming benjaoming requested review from a team as code owners May 22, 2023 22:09
@benjaoming benjaoming requested review from agjohnson and stsewd May 22, 2023 22:09
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

I'm quite excited we're taking this change on, I've wanted it for a while! I feel like this is close, but would be very close for merge without the decorator change.

@benjaoming benjaoming changed the title Organizations: Support URL scheme for unspecific organization w/ chooser page or automatic redirect Organizations: Organization chooser page May 24, 2023
…mit. If we want to re-introduce the feature, this commit can be reverted.
@benjaoming benjaoming force-pushed the organization-chooser-redirect branch from 8ef2a8c to 15c428e Compare May 24, 2023 13:00
Copy link
Contributor

@agjohnson agjohnson left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

@benjaoming benjaoming merged commit eedcd11 into main May 25, 2023
@benjaoming benjaoming deleted the organization-chooser-redirect branch May 25, 2023 17:34
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.

5 participants