Skip to content

Commit

Permalink
Unblock FxA broker on email change (#411)
Browse files Browse the repository at this point in the history
Why
---
There is a validation on email change that an account with a hub has an
email address stored.  However, some accounts with hubs exist without a
stored email address.  If the validation is necessary it should be
enforced when the record is persisted, not just accessed.  This failing
validation is blocking the FxA broker, which continues to retry the
event.

What
----
* Since email updates in Reticulum are broken anyway, remove the
  aforementioned validation
  • Loading branch information
bryanenders authored Sep 11, 2023
1 parent c385548 commit 256d192
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
1 change: 0 additions & 1 deletion lib/dash.ex
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ defmodule Dash do
def change_email(nil, _email), do: :ok

def change_email(%Dash.Account{email: nil} = account, email) when is_binary(email) do
[] = Dash.Hub.hubs_for_account(account)
update_email(account, email)
end

Expand Down
10 changes: 0 additions & 10 deletions test/dash_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ defmodule DashTest do
assert :ok === result
end

test "should raise, account has no previously set email, has hubs" do
expect_orch_post()

fxa_uid = "no_email"
account_without_email = Dash.Account.find_or_create_account_for_fxa_uid(fxa_uid)
Dash.Hub.create_default_hub(account_without_email, @old_email)

assert_raise MatchError, fn -> Dash.change_email(account_without_email, @new_email) end
end

test "should return :ok, account has previously set email and has no hubs" do
fxa_uid = "with_email"
account_with_email = Dash.Account.find_or_create_account_for_fxa_uid(fxa_uid, @old_email)
Expand Down

0 comments on commit 256d192

Please sign in to comment.