+ users =
+ from(u in User,
+ where: u.id in ^user_ids
+ )
+ |> Repo.all()
+
+ RecipientShip.create(users, participation)
+ :ok
+ end)
+
+ {:ok, Repo.preload(participation, :recipients, force: true)}
+ end
+
+ def unread_conversation_count_for_user(user) do
+ from(p in __MODULE__,
+ where: p.user_id == ^user.id,
+ where: not p.read,
+ select: %{count: count(p.id)}
+ )