diff --git a/lib/plausible.ex b/lib/plausible.ex index 803c259f9..b4c922618 100644 --- a/lib/plausible.ex +++ b/lib/plausible.ex @@ -4,7 +4,6 @@ defmodule Plausible do """ @ce_builds [:ce, :ce_test, :ce_dev] - @public_builds [:ce, :prod] defmacro __using__(_) do quote do @@ -59,12 +58,4 @@ defmodule Plausible do "Plausible Analytics" end end - - defmacro with_teams(do: do_block) do - if Mix.env() not in @public_builds do - quote do - unquote(do_block) - end - end - end end diff --git a/lib/plausible/auth/user_admin.ex b/lib/plausible/auth/user_admin.ex index 5be0fa09e..72df24b48 100644 --- a/lib/plausible/auth/user_admin.ex +++ b/lib/plausible/auth/user_admin.ex @@ -62,12 +62,10 @@ defmodule Plausible.Auth.UserAdmin do ] end - with_teams do - def after_update(_conn, user) do - Plausible.Teams.sync_team(user) + def after_update(_conn, user) do + Plausible.Teams.sync_team(user) - {:ok, user} - end + {:ok, user} end defp lock(user) do diff --git a/lib/plausible/site/memberships/accept_invitation.ex b/lib/plausible/site/memberships/accept_invitation.ex index 838338eb8..bde5bb9dc 100644 --- a/lib/plausible/site/memberships/accept_invitation.ex +++ b/lib/plausible/site/memberships/accept_invitation.ex @@ -41,9 +41,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do case Repo.transaction(multi) do {:ok, changes} -> - with_teams do - Plausible.Teams.Invitations.transfer_site_sync(site, user) - end + Plausible.Teams.Invitations.transfer_site_sync(site, user) membership = Repo.preload(changes.membership, [:site, :user]) @@ -77,9 +75,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do site = Repo.preload(invitation.site, :owner) with :ok <- Invitations.ensure_can_take_ownership(site, user) do - with_teams do - Plausible.Teams.Invitations.accept_transfer_sync(invitation, user) - end + Plausible.Teams.Invitations.accept_transfer_sync(invitation, user) site |> add_and_transfer_ownership(membership, user) @@ -89,9 +85,7 @@ defmodule Plausible.Site.Memberships.AcceptInvitation do end defp do_accept_invitation(invitation, user) do - with_teams do - Plausible.Teams.Invitations.accept_invitation_sync(invitation, user) - end + Plausible.Teams.Invitations.accept_invitation_sync(invitation, user) membership = get_or_create_membership(invitation, user) diff --git a/lib/plausible/site/memberships/create_invitation.ex b/lib/plausible/site/memberships/create_invitation.ex index ab52322c5..242956b64 100644 --- a/lib/plausible/site/memberships/create_invitation.ex +++ b/lib/plausible/site/memberships/create_invitation.ex @@ -82,9 +82,7 @@ defmodule Plausible.Site.Memberships.CreateInvitation do {:ok, invitation} <- Plausible.Repo.insert(changeset) do send_invitation_email(invitation, invitee) - with_teams do - Plausible.Teams.Invitations.invite_sync(site, invitation) - end + Plausible.Teams.Invitations.invite_sync(site, invitation) invitation else diff --git a/lib/plausible/users.ex b/lib/plausible/users.ex index 960438005..33020ff85 100644 --- a/lib/plausible/users.ex +++ b/lib/plausible/users.ex @@ -36,9 +36,7 @@ defmodule Plausible.Users do |> Auth.User.changeset(%{accept_traffic_until: accept_traffic_until(user)}) |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -112,9 +110,7 @@ defmodule Plausible.Users do |> Auth.User.start_trial() |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -125,9 +121,7 @@ defmodule Plausible.Users do |> Auth.User.changeset(%{allow_next_upgrade_override: true}) |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -139,9 +133,7 @@ defmodule Plausible.Users do |> Auth.User.changeset(%{allow_next_upgrade_override: false}) |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user else @@ -161,9 +153,7 @@ defmodule Plausible.Users do |> GracePeriod.start_changeset() |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -174,9 +164,7 @@ defmodule Plausible.Users do |> GracePeriod.start_manual_lock_changeset() |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -187,9 +175,7 @@ defmodule Plausible.Users do |> GracePeriod.end_changeset() |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end @@ -200,9 +186,7 @@ defmodule Plausible.Users do |> GracePeriod.remove_changeset() |> Repo.update!() - with_teams do - Plausible.Teams.sync_team(user) - end + Plausible.Teams.sync_team(user) user end diff --git a/lib/plausible_web/controllers/site/membership_controller.ex b/lib/plausible_web/controllers/site/membership_controller.ex index 5eb60f280..7c69ec3db 100644 --- a/lib/plausible_web/controllers/site/membership_controller.ex +++ b/lib/plausible_web/controllers/site/membership_controller.ex @@ -171,9 +171,7 @@ defmodule PlausibleWeb.Site.MembershipController do |> Membership.set_role(new_role) |> Repo.update!() - with_teams do - Plausible.Teams.Memberships.update_role_sync(membership) - end + Plausible.Teams.Memberships.update_role_sync(membership) redirect_target = if membership.user.id == current_user.id and new_role == :viewer do @@ -221,9 +219,7 @@ defmodule PlausibleWeb.Site.MembershipController do if membership do Repo.delete!(membership) - with_teams do - Plausible.Teams.Memberships.remove_sync(membership) - end + Plausible.Teams.Memberships.remove_sync(membership) membership |> PlausibleWeb.Email.site_member_removed()