projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'feat/format-optional-migrations' into 'develop'
[akkoma]
/
lib
/
pleroma
/
upload
/
filter.ex
diff --git
a/lib/pleroma/upload/filter.ex
b/lib/pleroma/upload/filter.ex
index d1384ddad23287d0ad91e66d8283df4ca6ac4d02..66113563494a5a72d442c9c9587817ecaa941403 100644
(file)
--- a/
lib/pleroma/upload/filter.ex
+++ b/
lib/pleroma/upload/filter.ex
@@
-1,3
+1,7
@@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
defmodule Pleroma.Upload.Filter do
@moduledoc """
Upload Filter behaviour
defmodule Pleroma.Upload.Filter do
@moduledoc """
Upload Filter behaviour
@@
-11,7
+15,11
@@
defmodule Pleroma.Upload.Filter do
require Logger
require Logger
- @callback filter(Pleroma.Upload.t()) :: :ok | {:ok, Pleroma.Upload.t()} | {:error, any()}
+ @callback filter(Pleroma.Upload.t()) ::
+ {:ok, :filtered}
+ | {:ok, :noop}
+ | {:ok, :filtered, Pleroma.Upload.t()}
+ | {:error, any()}
@spec filter([module()], Pleroma.Upload.t()) :: {:ok, Pleroma.Upload.t()} | {:error, any()}
@spec filter([module()], Pleroma.Upload.t()) :: {:ok, Pleroma.Upload.t()} | {:error, any()}
@@
-21,10
+29,13
@@
defmodule Pleroma.Upload.Filter do
def filter([filter | rest], upload) do
case filter.filter(upload) do
def filter([filter | rest], upload) do
case filter.filter(upload) do
- :ok ->
+ {:ok, :filtered} ->
+ filter(rest, upload)
+
+ {:ok, :filtered, upload} ->
filter(rest, upload)
filter(rest, upload)
- {:ok,
upload
} ->
+ {:ok,
:noop
} ->
filter(rest, upload)
error ->
filter(rest, upload)
error ->