More warning fixes.
This commit is contained in:
parent
a9baf955fa
commit
ffe028cd73
|
@ -74,7 +74,7 @@ def fix_emoji(object) 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
|
||||||
|
|
|
@ -147,21 +147,21 @@ def render("outbox.json", %{user: user, max_id: max_qid}) 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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue