Add ability to set a default post expiry #321

Merged
floatingghost merged 4 commits from per-user-post-expiry into develop 2022-11-28 13:34:54 +00:00
Showing only changes of commit 26bb7fcc39 - Show all commits

View file

@ -14,14 +14,14 @@ def change do
from(u in User,
where: u.local == true,
where: is_nil(u.keys),
select: u
select: u.id
)
Repo.stream(query)
|> Enum.each(fn user ->
with {:ok, pem} <- Keys.generate_rsa_pem() do
Ecto.Changeset.cast(user, %{keys: pem}, [:keys])
|> Repo.update()
Ecto.Changeset.cast(%User{id: user}, %{keys: pem}, [:keys])
|> Repo.update(returning: false)
end
end)
end