More warning fixes.

This commit is contained in:
lain 2018-05-07 18:11:37 +02:00
parent a9baf955fa
commit ffe028cd73
6 changed files with 15 additions and 7 deletions

View File

@ -74,7 +74,7 @@ def fix_emoji(object) do
name =
if String.starts_with?(name, ":") do
name = name |> String.slice(1..-2)
name |> String.slice(1..-2)
else
name
end

View File

@ -147,21 +147,21 @@ def render("outbox.json", %{user: user, max_id: max_qid}) do
end
end
def collection(collection, iri, page, _total \\ nil) do
def collection(collection, iri, page, total \\ nil) do
offset = (page - 1) * 10
items = Enum.slice(collection, offset, 10)
items = Enum.map(items, fn user -> user.ap_id end)
total = _total || length(collection)
total = total || length(collection)
map = %{
"id" => "#{iri}?page=#{page}",
"type" => "OrderedCollectionPage",
"partOf" => iri,
"totalItems" => length(collection),
"totalItems" => total,
"orderedItems" => items
}
if offset < length(collection) do
if offset < total do
Map.put(map, "next", "#{iri}?page=#{page + 1}")
end
end

View File

@ -14,6 +14,10 @@ defmodule Pleroma.Web.Federator do
@federating Keyword.get(@instance, :federating)
@max_jobs 20
def init(args) do
{:ok, args}
end
def start_link do
spawn(fn ->
# 1 minute

View File

@ -11,7 +11,7 @@ defmodule Pleroma.Web.OAuth.Authorization do
field(:valid_until, :naive_datetime)
field(:used, :boolean, default: false)
belongs_to(:user, Pleroma.User)
belongs_to(:app, Pleroma.App)
belongs_to(:app, App)
timestamps()
end

View File

@ -9,7 +9,7 @@ defmodule Pleroma.Web.OAuth.Token do
field(:refresh_token, :string)
field(:valid_until, :naive_datetime)
belongs_to(:user, Pleroma.User)
belongs_to(:app, Pleroma.App)
belongs_to(:app, App)
timestamps()
end

View File

@ -3,6 +3,10 @@ defmodule Pleroma.Web.Streamer do
require Logger
alias Pleroma.{User, Notification}
def init(args) do
{:ok, args}
end
def start_link do
spawn(fn ->
# 30 seconds