Merge branch 'develop' into feature/delivery-tracking
authorrinpatch <rinpatch@sdf.org>
Fri, 13 Sep 2019 16:42:53 +0000 (19:42 +0300)
committerrinpatch <rinpatch@sdf.org>
Fri, 13 Sep 2019 16:42:53 +0000 (19:42 +0300)
1  2 
lib/pleroma/user.ex
lib/pleroma/web/router.ex

index 785b22643dc0ff33ca3db32b7b7061bf3297721f,5e10ac25fdebbafea95fd58fde2380aa34305e66..e502279155d4a67e2789ce19b22acd48629cfa97
@@@ -1627,15 -1625,12 +1627,24 @@@ defmodule Pleroma.User d
    def is_internal_user?(%User{local: true, nickname: "internal." <> _}), do: true
    def is_internal_user?(_), do: false
  
 +  # A hack because user delete activities have a fake id for whatever reason
 +  # TODO: Get rid of this
 +  def get_delivered_users_by_object_id("pleroma:fake_object_id"), do: []
 +
 +  def get_delivered_users_by_object_id(object_id) do
 +    from(u in User,
 +      inner_join: delivery in assoc(u, :deliveries),
 +      where: delivery.object_id == ^object_id
 +    )
 +    |> Repo.all()
 +  end
++
+   def change_email(user, email) do
+     user
+     |> cast(%{email: email}, [:email])
+     |> validate_required([:email])
+     |> unique_constraint(:email)
+     |> validate_format(:email, @email_regex)
+     |> update_and_set_cache()
+   end
  end
Simple merge