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

fix ownership transfer when is_selfhost=true #2455

Merged

Conversation

ruslandoga
Copy link
Contributor

Changes

Fixes invitation links for ownership transfer in self-hosted setups.

More info: #2051

Tests

  • Automated tests have been added

Changelog

  • Entry has been added to changelog

Documentation

  • This change does not need a documentation update

Dark mode

  • This PR does not change the UI

@bundlemon
Copy link

bundlemon bot commented Nov 19, 2022

BundleMon

Unchanged files (7)
Status Path Size Limits
static/css/app.css
515.19KB -
static/js/dashboard.js
295.77KB -
static/js/app.js
12.13KB -
static/js/embed.host.js
5.58KB -
static/js/embed.content.js
5.06KB -
tracker/js/plausible.js
748B -
static/js/applyTheme.js
314B -

No change in files bundle size

Final result: ✅

View report in BundleMon website ➡️


Current branch size history | Target branch size history

if !Application.get_env(:plausible, :is_selfhost) do
if Application.get_env(:plausible, :is_selfhost) do
multi
else
end_trial_of_new_owner(multi, new_owner)
end
Copy link
Contributor Author

@ruslandoga ruslandoga Nov 19, 2022

Choose a reason for hiding this comment

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

This was retuning nil in self-hosted which was causing errors like this

plausible_1            | Server: example.com:80 (http)
plausible_1            | Request: POST /sites/invitations/sRdJ6PQkueG7fx0sfcENk/accept
plausible_1            | ** (exit) an exception was raised:
plausible_1            |     ** (FunctionClauseError) no function clause matching in Ecto.Multi.add_operation/3
plausible_1            |         (ecto 3.8.4) lib/ecto/multi.ex:640: Ecto.Multi.add_operation(nil, :membership, {:changeset, #Ecto.Changeset<action: :update, changes: %{role: :owner}, errors: [], data: #Plausible.Site.Membership<>, valid?: true>, []})
plausible_1            |         (plausible 0.0.1) lib/plausible_web/controllers/invitation_controller.ex:34: PlausibleWeb.InvitationController.accept_invitation/2
plausible_1            |         (plausible 0.0.1) lib/plausible_web/controllers/invitation_controller.ex:1: PlausibleWeb.InvitationController.action/2
plausible_1            |         (plausible 0.0.1) lib/plausible_web/controllers/invitation_controller.ex:1: PlausibleWeb.InvitationController.phoenix_controller_pipeline/2
plausible_1            |         (phoenix 1.6.6) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
plausible_1            |         (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint.plug_builder_call/2
plausible_1            |         (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint."call (overridable 3)"/2
plausible_1            |         (plausible 0.0.1) lib/plausible_web/endpoint.ex:1: PlausibleWeb.Endpoint.call/2

@ukutaht ukutaht merged commit 77cca04 into plausible:master Nov 24, 2022
@ruslandoga ruslandoga deleted the fix-transfer-ownership-self-hosted branch November 25, 2022 00:45
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.

2 participants