Revert "Pleroma.Web.PleromaAPI.UserImportController: Dialyzer errors"
This reverts commit 52e18a6249
.
This commit is contained in:
parent
4a80a285d1
commit
674ae51d6a
|
@ -61,9 +61,9 @@ def mutes_operation do
|
||||||
defp import_request do
|
defp import_request do
|
||||||
%Schema{
|
%Schema{
|
||||||
type: :object,
|
type: :object,
|
||||||
required: ["list"],
|
required: [:list],
|
||||||
properties: %{
|
properties: %{
|
||||||
"list" => %Schema{
|
list: %Schema{
|
||||||
description:
|
description:
|
||||||
"STRING or FILE containing a whitespace-separated list of accounts to import.",
|
"STRING or FILE containing a whitespace-separated list of accounts to import.",
|
||||||
anyOf: [
|
anyOf: [
|
||||||
|
|
|
@ -18,11 +18,11 @@ defmodule Pleroma.Web.PleromaAPI.UserImportController do
|
||||||
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
plug(Pleroma.Web.ApiSpec.CastAndValidate)
|
||||||
defdelegate open_api_operation(action), to: ApiSpec.UserImportOperation
|
defdelegate open_api_operation(action), to: ApiSpec.UserImportOperation
|
||||||
|
|
||||||
def follow(%{body_params: %{"list" => %Plug.Upload{path: path}}} = conn, _) do
|
def follow(%{body_params: %{list: %Plug.Upload{path: path}}} = conn, _) do
|
||||||
follow(%Plug.Conn{conn | body_params: %{"list" => File.read!(path)}}, %{})
|
follow(%Plug.Conn{conn | body_params: %{list: File.read!(path)}}, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
def follow(%{assigns: %{user: follower}, body_params: %{"list" => list}} = conn, _) do
|
def follow(%{assigns: %{user: follower}, body_params: %{list: list}} = conn, _) do
|
||||||
identifiers =
|
identifiers =
|
||||||
list
|
list
|
||||||
|> String.split("\n")
|
|> String.split("\n")
|
||||||
|
@ -35,20 +35,20 @@ def follow(%{assigns: %{user: follower}, body_params: %{"list" => list}} = conn,
|
||||||
json(conn, "job started")
|
json(conn, "job started")
|
||||||
end
|
end
|
||||||
|
|
||||||
def blocks(%{body_params: %{"list" => %Plug.Upload{path: path}}} = conn, _) do
|
def blocks(%{body_params: %{list: %Plug.Upload{path: path}}} = conn, _) do
|
||||||
blocks(%Plug.Conn{conn | body_params: %{"list" => File.read!(path)}}, %{})
|
blocks(%Plug.Conn{conn | body_params: %{list: File.read!(path)}}, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
def blocks(%{assigns: %{user: blocker}, body_params: %{"list" => list}} = conn, _) do
|
def blocks(%{assigns: %{user: blocker}, body_params: %{list: list}} = conn, _) do
|
||||||
User.Import.blocks_import(blocker, prepare_user_identifiers(list))
|
User.Import.blocks_import(blocker, prepare_user_identifiers(list))
|
||||||
json(conn, "job started")
|
json(conn, "job started")
|
||||||
end
|
end
|
||||||
|
|
||||||
def mutes(%{body_params: %{"list" => %Plug.Upload{path: path}}} = conn, _) do
|
def mutes(%{body_params: %{list: %Plug.Upload{path: path}}} = conn, _) do
|
||||||
mutes(%Plug.Conn{conn | body_params: %{"list" => File.read!(path)}}, %{})
|
mutes(%Plug.Conn{conn | body_params: %{list: File.read!(path)}}, %{})
|
||||||
end
|
end
|
||||||
|
|
||||||
def mutes(%{assigns: %{user: user}, body_params: %{"list" => list}} = conn, _) do
|
def mutes(%{assigns: %{user: user}, body_params: %{list: list}} = conn, _) do
|
||||||
User.Import.mutes_import(user, prepare_user_identifiers(list))
|
User.Import.mutes_import(user, prepare_user_identifiers(list))
|
||||||
json(conn, "job started")
|
json(conn, "job started")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue