Skip to content

Commit 1d07248

Browse files
authored
misc fixes (#487)
1 parent 401b211 commit 1d07248

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

apps/cf_jobs/lib/application.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule CF.Jobs.Application do
2323

2424
# Do not start scheduler in tests
2525
children =
26-
if env == :test,
26+
if env == :test or Application.get_env(:cf, :disable_scheduler),
2727
do: children,
2828
else: children ++ [worker(CF.Jobs.Scheduler, [])]
2929

apps/db/lib/db_schema/user.ex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,19 @@ defmodule DB.Schema.User do
8686
|> common_changeset(params)
8787
|> validate_length(:password, min: 6, max: 256)
8888
|> put_encrypted_pw
89+
|> set_unconfirmed_if_new_email(model, params)
8990
end
9091

92+
defp set_unconfirmed_if_new_email(changeset, model, %{"email" => email}) do
93+
if model && !is_nil(email) && email != model.email do
94+
put_change(changeset, :email_confirmed, false)
95+
else
96+
changeset
97+
end
98+
end
99+
100+
defp set_unconfirmed_if_new_email(changeset, _model, _params), do: changeset
101+
91102
@doc """
92103
Generate a changeset to update `reputation` and `today_reputation_gain` without verifying daily limits
93104
"""

0 commit comments

Comments
 (0)