Skip to content

Commit

Permalink
Sync team consistently on site creation (plausible#4736)
Browse files Browse the repository at this point in the history
  • Loading branch information
zoldar authored Oct 24, 2024
1 parent 2ec9e32 commit 0404522
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions lib/plausible/sites.ex
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,9 @@ defmodule Plausible.Sites do
Site.Membership.new(site, user)
end)
|> maybe_start_trial(user)
|> Ecto.Multi.run(:sync_team, fn
_repo, %{user: user} ->
Plausible.Teams.sync_team(user)
{:ok, nil}

_repo, _context ->
{:ok, nil}
|> Ecto.Multi.run(:sync_team, fn _repo, %{user: user} ->
Plausible.Teams.sync_team(user)
{:ok, nil}
end)
|> Repo.transaction()
end
Expand All @@ -226,7 +222,7 @@ defmodule Plausible.Sites do
end)

_ ->
multi
Ecto.Multi.put(multi, :user, user)
end
end

Expand Down

0 comments on commit 0404522

Please sign in to comment.