X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=lib%2Fpleroma%2Fuser.ex;h=b44ba12799a2de96583116771e4820da93fdf761;hb=6ca633ddd30e8330e47f6456fe16fa72506e2e13;hp=60d1d4811720c76c4151c71be00c30548c24bf42;hpb=00d43333735acbcadc1dd04ff793f4ce6e8eecb1;p=akkoma diff --git a/lib/pleroma/user.ex b/lib/pleroma/user.ex index 60d1d4811..b44ba1279 100644 --- a/lib/pleroma/user.ex +++ b/lib/pleroma/user.ex @@ -5,13 +5,23 @@ defmodule Pleroma.User do use Ecto.Schema - import Ecto.{Changeset, Query} - alias Pleroma.{Repo, User, Object, Web, Activity, Notification} + import Ecto.Changeset + import Ecto.Query + + alias Pleroma.Repo + alias Pleroma.User + alias Pleroma.Object + alias Pleroma.Web + alias Pleroma.Activity + alias Pleroma.Notification alias Comeonin.Pbkdf2 alias Pleroma.Formatter alias Pleroma.Web.CommonAPI.Utils, as: CommonUtils - alias Pleroma.Web.{OStatus, Websub, OAuth} - alias Pleroma.Web.ActivityPub.{Utils, ActivityPub} + alias Pleroma.Web.OStatus + alias Pleroma.Web.Websub + alias Pleroma.Web.OAuth + alias Pleroma.Web.ActivityPub.Utils + alias Pleroma.Web.ActivityPub.ActivityPub require Logger @@ -315,7 +325,16 @@ defmodule Pleroma.User do q = from(u in User, where: u.id == ^follower.id, - update: [set: [following: fragment("array_cat(?, ?)", u.following, ^followed_addresses)]] + update: [ + set: [ + following: + fragment( + "array(select distinct unnest (array_cat(?, ?)))", + u.following, + ^followed_addresses + ) + ] + ] ) {1, [follower]} = Repo.update_all(q, [], returning: true)