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 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
name = name =
if String.starts_with?(name, ":") do if String.starts_with?(name, ":") do
name = name |> String.slice(1..-2) name |> String.slice(1..-2)
else else
name name
end end

View file

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

View file

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

View file

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

View file

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

View file

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