-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch
AcceptInvitation
ops to read from team schemas behind FF (#4847
) * Move `bulk_transfer_ownership_direct` under `AcceptInvitation` * [WIP] Switch ownership transfer operations to read from team schemas behind FF * Fix usage test regression * Semantics - current user; ownership is not necessarily involved * Perform remaining read via adapter; remove obsolete test * Properly list site with pending site transfer while being guest on a team * Account for pending site transfers in Settings > People list --------- Co-authored-by: Adam Rutkowski <[email protected]>
- Loading branch information
Showing
15 changed files
with
426 additions
and
654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -75,16 +75,15 @@ defmodule Plausible.Site.AdminTest do | |
end | ||
|
||
test "new owner must be an existing user", %{conn: conn, transfer_direct_action: action} do | ||
site = insert(:site) | ||
site = new_site() | ||
|
||
assert action.(conn, [site], %{"email" => "[email protected]"}) == | ||
{:error, "User could not be found"} | ||
end | ||
|
||
test "new owner can't be the same as old owner", %{conn: conn, transfer_direct_action: action} do | ||
current_owner = insert(:user) | ||
|
||
site = insert(:site, members: [current_owner]) | ||
current_owner = new_user() | ||
site = new_site(owner: current_owner) | ||
|
||
assert {:error, "User is already an owner of one of the sites"} = | ||
action.(conn, [site], %{"email" => current_owner.email}) | ||
|
@@ -96,20 +95,16 @@ defmodule Plausible.Site.AdminTest do | |
transfer_direct_action: action | ||
} do | ||
today = Date.utc_today() | ||
current_owner = insert(:user) | ||
current_owner = new_user() | ||
|
||
new_owner = | ||
insert(:user, | ||
subscription: | ||
build(:growth_subscription, | ||
last_bill_date: Timex.shift(today, days: -5) | ||
) | ||
) | ||
new_user() | ||
|> subscribe_to_growth_plan(last_bill_date: Date.shift(today, day: -5)) | ||
|
||
# fills the site limit quota | ||
insert_list(10, :site, members: [new_owner]) | ||
for _ <- 1..10, do: new_site(owner: new_owner) | ||
|
||
site = insert(:site, members: [current_owner]) | ||
site = new_site(owner: current_owner) | ||
|
||
assert {:error, "Plan limits exceeded" <> _} = | ||
action.(conn, [site], %{"email" => new_owner.email}) | ||
|
@@ -120,18 +115,14 @@ defmodule Plausible.Site.AdminTest do | |
transfer_direct_action: action | ||
} do | ||
today = Date.utc_today() | ||
current_owner = insert(:user) | ||
current_owner = new_user() | ||
|
||
new_owner = | ||
insert(:user, | ||
subscription: build(:subscription, last_bill_date: Timex.shift(today, days: -5)) | ||
) | ||
|
||
site1 = | ||
insert(:site, memberships: [build(:site_membership, user: current_owner, role: :owner)]) | ||
new_user() | ||
|> subscribe_to_growth_plan(last_bill_date: Date.shift(today, day: -5)) | ||
|
||
site2 = | ||
insert(:site, memberships: [build(:site_membership, user: current_owner, role: :owner)]) | ||
site1 = new_site(owner: current_owner) | ||
site2 = new_site(owner: current_owner) | ||
|
||
assert :ok = action.(conn, [site1, site2], %{"email" => new_owner.email}) | ||
end | ||
|
Oops, something went wrong.