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

Count pending ownership sites towards account usage on the upgrade page #4277

Merged
merged 10 commits into from
Jun 27, 2024

Conversation

RobertJoonas
Copy link
Contributor

Changes

When the user goes to upgrade to a plan, currently we let them upgrade to a suitable plan based on the usage across their owned sites. When the user has pending ownerships however, they might not be able to accept them, even after upgrading to a seemingly suitable plan, which can be annoying/confusing.

Whenever there are pending site ownerships, a message will be shown to the user:

image

Counting the usage from pending ownerships means that we are not letting them upgrade to a plan that would not accommodate all the pending sites. Same goes for warning about losing access to a feature used be a pending ownership site.

Tests

  • Automated tests have been added

Changelog

  • This PR does not make a user-facing change

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

opts
|> Keyword.get(:exclude_emails, [])
|> List.wrap()
def team_member_usage(%User{} = user, opts) do
Copy link
Contributor Author

@RobertJoonas RobertJoonas Jun 25, 2024

Choose a reason for hiding this comment

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

This went through a bit more extensive refactor. I imagine it's pretty difficult to grasp at first sight so let me try to break it down a bit:

  • We don't actually need the site option - this was only used to calculate the usage of the "to be transferred" site, which was added to the user's current team member usage to get the "usage after transfer". The same can be achieved through the pending_ownership_site_ids option.
  • When querying memberships, we will first count the owner too, and later filter that out by exclude_emails which always contains the given user. That's because for pending ownerships we do want to count owners (after ownership is accepted by the user, the previous owner will remain an admin of the site)

@RobertJoonas RobertJoonas requested a review from a team June 25, 2024 15:11
@RobertJoonas RobertJoonas force-pushed the choose-plan-pending-ownership-transfers branch from 930bd1f to fe20d17 Compare June 25, 2024 16:00
@RobertJoonas RobertJoonas merged commit 07a54ef into master Jun 27, 2024
10 checks passed
@RobertJoonas RobertJoonas deleted the choose-plan-pending-ownership-transfers branch June 27, 2024 09:09
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.

None yet

2 participants