User.follow_all: ensure its stays unique
This commit is contained in:
parent
44913c1019
commit
308b35ebe2
2 changed files with 23 additions and 1 deletions
|
|
@ -315,7 +315,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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue