MastoAPI: Implement all streaming functions.

This commit is contained in:
Roger Braun 2017-11-16 16:49:51 +01:00
commit a743940463
7 changed files with 73 additions and 6 deletions

View file

@ -284,6 +284,17 @@ defmodule Pleroma.User do
Repo.all(query)
end
def get_recipients_from_activity(%Activity{data: %{"to" => to}} = activity) do
query = from u in User,
where: u.local == true
query = from u in query,
where: u.ap_id in ^to,
or_where: fragment("? \\\?| ?", u.following, ^to)
Repo.all(query)
end
def search(query, resolve) do
if resolve do
User.get_or_fetch_by_nickname(query)