From: rinpatch Date: Fri, 13 Sep 2019 16:42:53 +0000 (+0300) Subject: Merge branch 'develop' into feature/delivery-tracking X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=ba70a8cae6c0d00963dc1d9e80f915186397ad06;p=akkoma Merge branch 'develop' into feature/delivery-tracking --- ba70a8cae6c0d00963dc1d9e80f915186397ad06 diff --cc lib/pleroma/user.ex index 785b22643,5e10ac25f..e50227915 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@@ -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