* Add `locked` to Team schema and add predicate helper in Teams
* Update `team.locked` in parallel with `sites.locked` in SiteLocker
* Adjust team backfill migration to ignore locked team field
* Add `Team.hourly_api_request_limit` and update it on plan change
* Fix tests for CE
* Fix CE tests once more
* Add backfill script
* Fix backfill script tests for CE
* Update role enums with billing
* [wip] Ensure no team management can be done for roles other than admin/editor
* Track `current_role` at plug/mount level
* Some team role policy enforcement
* Guard remaining routes based on current team role
* Notify billing members via check usage worker
* Include billing members in trial/locked notifications
* Permissive team access policy when no current team assigned
Effectively the plug should no-op, so that existing user
notices/alerts can be displayed.
* Send cancellation notifications to billing role members
* Include billing members in renewal notifications
* Update moduledoc
* Exclude :guest role from team access auth plug
* Rename "My Team" to "My Personal Sites"
* Rename "Create" to "Setup" in context of teams
* Set default Team Name to "Username's Team"
* wip
* end
* Expose team identifier
* fixup
* team id
* wip
* Rename `Teams.name()` -> `Teams.default_name()` for clarity
* Update test name
* Always reset team name when navigating to Team CTA
* Always use default team name for non-setup team
* Add tests for team name function
* Put sites list heading change behind FF
* Don't rely on FF for implicit team existence check
* Remove unnecessary team pick by parameter in site creation action
* Put first 3 teams in auth assigns context
* Fix setting current team from session
* Make `dropdown_item` component accept method for link
* Implement embedded team switcher in nav bar
* Store only personal team under my_team
* WIP
* Minor team switcher visual tweak
* Fix personal team selection
* Show only guest sites when no team picked
* Show CTA only in reference to `@my_team`
* Fix dedicated team switcher view
* Move picker indicator to the right in dedicated team select
* Alter site listing logic and fix tests
* Add viewer invitation to seeds
* Fix embedded team switch display condition
* Switch current team after setup
* Explicitly clean current team session value when no longer valid
* Remove redundant team switching logic
* Add quick link to team settings
* Don't show quick link when there's no current team
* Fix dedicated team switcher for no current team case
* Add test for my team fallback case
* Don't allow opening team settings for personal team
* Fix formatting
* Add site listing tests
* Fix team switching to avoid clash with existing conn params
* Fix formatting
* Remove unneeded `method` from `dropdown_item` component
* Decalre attributes for `team_switcher` component
* Render Invoices/Subscription sections based on team state
* Fix formatting
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Add tests for `Teams.get_or_create/1` and `Teams.get_by_owner/1`
* Start populating `current_team` in assigns fetching value from session
* Clean up team passing in invitation services
* Make site transfer service handle multi-team scenario
* Handle multi-team and permission transfer errors on controller level
* Handle multi-teams in site creation on service and controller level
* Drop validation limiting full membership to a single team
* Make user deletion account for public team ownership
* Adjust feature availability checks for Stats API key
* Use current_team when determining limits on site transfer invitation
* Adjust trial upgrade email submission to account for multiple owners
* Remove unnecessary `Teams.load_for_site/1`
* Spike renaming `owner` and `ownership` relationships to plural versions
* Make HelpScout integration handle owner of multiple teams gracefully
* Add FIXME note
* Resolve paddle callback issue by always provisioning a new team when none passed
* Set `current_team` as `my_team` only when user is an owner
* Implement basics of Teams CRM
* Extend Teams CRM
* Further adjust User and Site CRM and refine Team CRM
* Convert Enterprise Plan CRM to refer to team directly and not via user
* Remove unused virtual fields from User schema
* Add note to HelpScout integration
* Allow listing multiple owners under Site Settings / People
* Remove unused User schema relations
* Fix current team fetch in auth plug and context
* Implement basic team switcher
* Ensure (site) editor role is properly handled in site actions auth
* Don't set `site_limit_exceeded` error marker on `permission_denied` error
* Link from HS integration to Team CRM instead of User CRM when available
* Ensure consistent ordering of preloaded owners
* Add `with_subscription` preload for optimisitation
* Add ability to search sites by team identifier
* Add ability to pick team when transferring ownership directly
* Fix failing HelpScout tests
* Scope by team when listing sites in dashboard and via API (optional)
* Add ability to search by team identifier in plans CRM lookup widget
* Add subscription plan, status and grace period to team status info
* Expose teams list in user CRM edit form and fix team details CRM view
* Fix Team Switcher styling
* Reorganise header nav menu
* Avoid additional queries when authenticating user
* Hide the pay/site transfer message on lock screen when teams FF is on
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Start PromEx first; don't run the Oban plugin in test
* Implement `find_team_invitations`
* Implement `all_members`
* Allow disabling e-mail notifications on team member removal
Will be needed later, when operations are applied
in bulk and notifications go out only when transaction
succeeded.
* Fix visuals per @ukutath's suggestions
* Add `:setup_team` test context function
* Don't show team settings in the sidebar, if setup incomplete
* Add high-level interface for team layout arrangement
Will be used in setup but also later on, in membership settings.
* Update team/setup to use `Team.Management.Layout`
* Implement team general settings allowing layout arrangement
* Format
* Remove unused setup_team
* Add id attributes to member dropdown elements
* Format
* Unify team management experience
By sharing the same form layout in both views,
and enabling promoting guests to team members
in a separate section.
* Rename Invitations/Memberships getters
* Tweak team setup layout
* Update team setup markers only once
* Update tests
* Add another future regression test
* Fix typo
* Prune guest memberships on guest->team member promotion
* Remove now unnecessary `Candidates` module
* Add missing tests
* Catch up on multiple owners fixes
* Add missing describe-block setup
* Hopefully make Layout easier to follow
* Remove default prevention from dropdown
* Remove unused assign
* Make `sorted_for_display` skip scheduled for deletion
* `use PlausibleWeb.Component`
* Use `data-test-kind` for test specific selectors
* Remove `class="relative"` from `.dropdown` instances
* Move `GracePeriod` under `Teams` and clean it up a bit
* Switch to relying on new team membership constraint when creating my team
* Remove unused unique_constraint from Teams.Membership schema changeset
* Implement scaffolding for team member and invite mgmt actions
* Implement updating team role
* Prevent changing role if the subject is the only remaining owner
* Implement removing team membership
* Fix only remaining owner removal checks
* Fix remove team membership service
* Fix and clean up imports
* Implement team invitation removal
* Fix errors surfaced by dialyzer
* Test and fix removing team invitations
* Make accept invitation action work for team invitations
* Test rejecting team invitation
* Test team membership role update and removal actions
* Fix flash message interpolation and missing team in transfer result
* Implement migration adding UUID identifier to team
* Set UUID identifier on team creation
* Implement get team by identifier
* Display team invitations on /sites
* Test rendering team invitations on /sites
* Add team management notices on /settings/people
* Test showing team management notices on /settings/people
* Stop drawing double horizontal rule
* Add modueldoc
* Handle guest member trying to call team membership endpoints gracefully
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* spike
* wip omg
* Add option to clear combobox dropdown on selection
* Extend combobox on selection made callback
* Remove IO.inspect
* Add more guests via seeds
* Implement basic UX for arbitrary e-mail addresses
* Save team name on change
* Don't crash on invalid team name input
* Enable :teams flag via seeds
* Implement changing roles
* Display avatars in combobox when selecting member candidates
* Reduce noise
* Add 'Create team' button to the layout
* Revert "Extend combobox on selection made callback"
This reverts commit 874d566d12.
* Fix seeds
* Make email submittion optional in InviteToTeam service
* Implement finalising team setup (WIP)
* Revert "Display avatars in combobox when selecting member candidates"
This reverts commit ff1a30deb3.
* Use regular redirect to preserve flash
* Check team's setup complete status on mount
* Add `dev` param, allowing redirect skip on setup complete
* Bootstrap test module
* Add sample test touching on combobox in team setup
* WIP: testing team setup LV
* Fixup test
* Remove unused bindings
* Add another minor test
* Test removing a member candidate
* Finish up remaining tests
* Rename main module
* Put team setup view behind a feature flag
* Update main nav dropdown
* Update ComboBox tests
* Fix CandidatesTest regression
* Bring back OG combo-box.js
* Fix dark mode red
* Minor styling fixes
* Extract setup_team function into context
* Remove Floki calls, use Plausible.HTML proxy instead
* Make credo happy
* Use path helpers instead of hardcoded paths
* Fix formatting
* Revert "Merge branch 'master' into setup-teams-01"
This reverts commit bc436c50f8, reversing
changes made to 2eb128d91e.
* Reapply "Merge branch 'master' into setup-teams-01"
This reverts commit c7ebdd2156.
* Alter clear_on_select behavior
* Revert "Alter clear_on_select behavior"
This reverts commit deb20c41f0.
* Look up guests with distinct:true
* Revert "Look up guests with distinct:true"
This reverts commit 352d2717f4.
* Look up guests with distinct:true
* Try something dumb
* huh?
* Bring back problematic changes
* Make combobox dropdown open state and spinner behave on form update
* Don't explicitly send update on live component attribute update
* Don't explicitly send updates to options in funnel combobox either
* Revert "Temporarily disable combobox spinner (#4971)"
This reverts commit 3abf974a56.
* Fix formatting
* Set 'id' on element with phx-update=ignore
* Rework options and suggestions setup in combobox
* Fix suggestions for async
* Fix formatting
---------
Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
* Implement controller action for changing team name
* Extract mobile navigation dropdown
So that it displays grouped "Team Settings"
sections, but is also backwards compatible with
current Site Settings structure, where Shields are
interleaved (subsection rather than a separate group).
By the way, fix a bug where submitting a changeset
error will confuse the dropdown - it used to check if
path info ends with tab name, but POST requests usually
go to a more specific path, than the one that displays
multiple tiles & allows different form submissions 😅
* Expose Teams feature flag check
* Collect setting sidebars functions
* Add basic controller test
* Enable `:teams` flag on test
* Tests should only fire on EE run
* Remove EE restriction; gatekeep only via feature flag
* Remove `action` component attribute
no idea why it was even there before
* Comment out legacy fields and relationships
* WIP
* WIP 2
* WIP 3
* wip
* Remove teams backfill and consistency check scripts
* WIP 3
* Fix CheckUsage tests
* Update billing/subscription tests
* WIP 4
* Make site transfer fail if some invitation already exists
* Fixup: do symmetric invitation/site transfer check
* Update UI bugs: make listing sites/inviting admins work like before
* Fix Sites test
* Fix external sites controller test
* Fix live sites tests
* Fix props availability lookup
* Fix site controller tests
* Fix billing controller tests
* WIP - accept invitation tests
* Another round of test fixes + invitations logic bugs
* users_test -> teams_test
* Update registration via invitation
Here, we still rely on "polymorphic" invitation structures,
hence the "unified by id" helper.
For now, it'll remain local unless we discover it's
needed in the broader `Teams.Invitations` context.
cc @zoldar
* Yet another round of test and bugfixes along the way
* Include team in site setup success e-mail
* Fix send_site_setup_emails worker
* Fixed almost all tests except CRM ones
* Update enterprise plan admin test
* Fix CRM + remaining tests
* Address credo warnings (modulo one FIXME)
* Remove last FIXME and rephrase the invitation test case description
* Set Team fields via User CRM transparently
* Map user reference in Enterprise Plan CRM via team owner
* Fix resource actions in user CRM
* Get rid of warning when opening create form in API keys CRM
* Stop emitting warnings when editing Enterprise Plans via CRM
* Tests: Bump await_clickhouse_count interval
* Remove XXX marker
* Fix register from invitation link in email sent for ownership transfer
* Simplify fetching all pending site ownership site IDs
* Remove commented out schema fields
* Remove unused functions
* Address flakiness in ingest counter tests
* Remove unused `Teams.Sites.create`
* Don't restart trial on team with subscription when creating site
* Account for cases of legacy teams with empty trial expiry date
* Revert "Address flakiness in ingest counter tests"
This reverts commit 60dc1e4115.
* Fix flaky ingest counters tests under load
* Attempt 2
* Pre-emptively hardcode site ids in sampling cache test
to avoid supplying the same IDs alongside with counters test,
that inserts through another repo (async).
what we're observing is, clickhouse not summing mergetree columns fast
enough, even though we wait quite a bit.
* Fix ingest counter tests by accounting for delayed summation
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Pre-emptively introduce `site.team_owner` relation
* Drop null constraint on user_id from subscriptions and enterprise_plans
* Temporarily remove populating old schemas in Teams.Test
* Point to site.owner via new schema
* Switch more reads to teams schema WIP
* Fix AuhtorizeSiteAccess test
There's no need to translate `admin`<->`editor` here,
the redundancy is inlined wherever the plug is initialized.
* Fix regions test
* Fix main graph test
* Fix authorization test
* Try to rely on team for subscription/plans where applicable
* Test fixes
* Fix plans test
* Prep for CheckUsage changes
* Skip remaining CheckUsage tests for now
* Fix user deletion to account for team relations
* Fix HelpScout tests
* 💀 Modify ingestion to read team schemas
* Made all tests green except skipped ones
* Mute warnings about transferring site with no order
By making artificial site membership struct,
when reading data off team membership schema.
* Fix site removal test case
* Re-enable locked site tests, that don't have to rely on `SiteLocker`
* Format
* Revert "Mute warnings about transferring site with no order"
This reverts commit 0e45f8c9d9.
* Re-enable old models and fix remaining tests
* Use new factories in a long running minio test
* FIXME->TODO
* Fix remaining tests in legacy mode (no FF raised)
* oof
cc @zoldar
* Add missing definitions of editor role in FE code
* Remove no longer relevant comment about roles
* Fix JS formatting
* Always prioritize site transfers over memberships in sites list
* Fix misaligned "Reject" invitation button
* Fix site pinning when user is guest in multiple sites in team
* Fix subscription settings controller tests
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>
* Extend schemas with new fields and relationships for teams
* Implement listing sites and sites with invitations with teams
* Implement creating invitations with teams
* Implement accepting invites with teams
* Add `Teams.SiteTransfer` schema
* Implement creating ownership transfers
* Implement accepting site transfer between teams
* Make results shapes from `Teams.Memberships` role functions more consistent
* Remove :team relation from ApiKey schema
* Pass and provision team on subscription creation
* Pass and provision team on enterprise plan creation
* Implement creating site for a team
* Keep team in sync during legacy ownership transfer and invitations
* Resolve conflict in `Teams.get_or_create` without transaction
* Abstract `GracePeriod` manipulation behind `Plausible.Users`
* Put `User.start_trial` behind `Plausible.Users` API
* Sync team fields on user update, if team exists
* Sync cleaning invitations, updating and removing members
* Transfer invitations too
* Implement backfill script
* Allow separate pg repo for backfill script
* Rollback purposefully at the end
* Update backfill script with parallel processing
* Use `IS DISTINCT FROM` when comparing nullable fields
* Handle no teams to backfill case gracefully when reporting
* Parallelize guest memberships backfill
* Remove transaction wrapping and query timeouts
* Make team sync check more granular and fix formatting
* Wrap single team backfill in a transatction for consistent restarts
* Make invitation and site transfer backfills preserve invitation ID
* Update migration repo config for easier dev access
* Backfill teams for users with subscriptions without sites
* Log timestamps
* Put teams sync behind a compile-time flag
* Keep timestamps in sync and fix subscriptions backfill
* Fix formatting
* Make credo happy
* Don't `use Plausible.Migration` to avoid dialyzer complaining
None of the tooling from there is used anywhere and `@repo` can
be defined directly in the migration script.
* Drop SSL workarounds in the backfill script
---------
Co-authored-by: Adam Rutkowski <hq@mtod.org>