commit: ffe028cd7392404c85ab65eca167a16e85b3f788
parent a9baf955fa47b58ec9ae1f90da14abc10379dcde
Author: lain <lain@soykaf.club>
Date: Mon, 7 May 2018 18:11:37 +0200
More warning fixes.
Diffstat:
6 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/lib/pleroma/web/activity_pub/transmogrifier.ex b/lib/pleroma/web/activity_pub/transmogrifier.ex
@@ -74,7 +74,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
name =
if String.starts_with?(name, ":") do
- name = name |> String.slice(1..-2)
+ name |> String.slice(1..-2)
else
name
end
diff --git a/lib/pleroma/web/activity_pub/views/user_view.ex b/lib/pleroma/web/activity_pub/views/user_view.ex
@@ -147,21 +147,21 @@ defmodule Pleroma.Web.ActivityPub.UserView 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
diff --git a/lib/pleroma/web/federator/federator.ex b/lib/pleroma/web/federator/federator.ex
@@ -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
diff --git a/lib/pleroma/web/oauth/authorization.ex b/lib/pleroma/web/oauth/authorization.ex
@@ -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
diff --git a/lib/pleroma/web/oauth/token.ex b/lib/pleroma/web/oauth/token.ex
@@ -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
diff --git a/lib/pleroma/web/streamer.ex b/lib/pleroma/web/streamer.ex
@@ -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