diff --git a/lib/pleroma/web/templates/feed/feed/_activity.atom.eex b/lib/pleroma/web/templates/feed/feed/_activity.atom.eex
index 78350f2aa..3fd150c4e 100644
--- a/lib/pleroma/web/templates/feed/feed/_activity.atom.eex
+++ b/lib/pleroma/web/templates/feed/feed/_activity.atom.eex
@@ -12,7 +12,7 @@
<% end %>
<%= if @activity.local do %>
diff --git a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex
index a304a16af..42960de7d 100644
--- a/lib/pleroma/web/templates/feed/feed/_activity.rss.eex
+++ b/lib/pleroma/web/templates/feed/feed/_activity.rss.eex
@@ -12,7 +12,7 @@
<% end %>
<%= if @activity.local do %>
diff --git a/lib/pleroma/web/templates/layout/app.html.eex b/lib/pleroma/web/templates/layout/app.html.eex
index 3f28f1920..1ede59fd8 100644
--- a/lib/pleroma/web/templates/layout/app.html.eex
+++ b/lib/pleroma/web/templates/layout/app.html.eex
@@ -1,233 +1,19 @@
-
+
-
diff --git a/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex b/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
index b17142ff8..1a85818ec 100644
--- a/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
+++ b/lib/pleroma/web/templates/o_auth/o_auth/show.html.eex
@@ -5,32 +5,55 @@
<%= form_for @conn, o_auth_path(@conn, :authorize), [as: "authorization"], fn f -> %>
-<%= if @params["registration"] in ["true", true] do %>
-
Choose carefully! You won't be able to change this later. You will be able to change your display name, though.
- <%= label f, :nickname, "Pleroma Handle" %>
- <%= text_input f, :nickname, placeholder: "lain" %>
+<%= if @user do %>
+
- <%= hidden_input f, :name, value: @params["name"] %>
- <%= hidden_input f, :password, value: @params["password"] %>
-
-<% else %>
-
- <%= label f, :name, "Username" %>
- <%= text_input f, :name %>
-
-
- <%= label f, :password, "Password" %>
- <%= password_input f, :password %>
-
- <%= submit "Log In" %>
- <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
<% end %>
+
+ <%= if @app do %>
+
Application <%= @app.client_name %> is requesting access to your account.
+ <%= render @view_module, "_scopes.html", Map.merge(assigns, %{form: f}) %>
+ <% end %>
+
+ <%= if @user do %>
+
+
Cancel
+ <%= submit "Approve", class: "button--approve" %>
+
+ <% else %>
+ <%= if @params["registration"] in ["true", true] do %>
+
This is the first time you visit! Please enter your Pleroma handle.
+
Choose carefully! You won't be able to change this later. You will be able to change your display name, though.
+
+ <%= label f, :nickname, "Pleroma Handle" %>
+ <%= text_input f, :nickname, placeholder: "lain" %>
+
+ <%= hidden_input f, :name, value: @params["name"] %>
+ <%= hidden_input f, :password, value: @params["password"] %>
+
+ <% else %>
+
+ <%= label f, :name, "Username" %>
+ <%= text_input f, :name %>
+
+
+ <%= label f, :password, "Password" %>
+ <%= password_input f, :password %>
+
+ <%= submit "Log In" %>
+ <% end %>
+ <% end %>
+
+
<%= hidden_input f, :client_id, value: @client_id %>
<%= hidden_input f, :response_type, value: @response_type %>
<%= hidden_input f, :redirect_uri, value: @redirect_uri %>
@@ -40,4 +63,3 @@
<%= if Pleroma.Config.oauth_consumer_enabled?() do %>
<%= render @view_module, Pleroma.Web.Auth.Authenticator.oauth_consumer_template(), assigns %>
<% end %>
-
diff --git a/lib/pleroma/web/twitter_api/controller.ex b/lib/pleroma/web/twitter_api/controller.ex
index f42dba442..16f43863c 100644
--- a/lib/pleroma/web/twitter_api/controller.ex
+++ b/lib/pleroma/web/twitter_api/controller.ex
@@ -31,10 +31,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
def confirm_email(conn, %{"user_id" => uid, "token" => token}) do
with %User{} = user <- User.get_cached_by_id(uid),
true <- user.local and user.confirmation_pending and user.confirmation_token == token,
- {:ok, _} <-
- user
- |> User.confirmation_changeset(need_confirmation: false)
- |> User.update_and_set_cache() do
+ {:ok, _} <- User.confirm(user) do
redirect(conn, to: "/")
end
end
diff --git a/lib/pleroma/web/twitter_api/controllers/password_controller.ex b/lib/pleroma/web/twitter_api/controllers/password_controller.ex
index 800ab8954..b1a9d810e 100644
--- a/lib/pleroma/web/twitter_api/controllers/password_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/password_controller.ex
@@ -17,6 +17,7 @@ defmodule Pleroma.Web.TwitterAPI.PasswordController do
def reset(conn, %{"token" => token}) do
with %{used: false} = token <- Repo.get_by(PasswordResetToken, %{token: token}),
+ false <- PasswordResetToken.expired?(token),
%User{} = user <- User.get_cached_by_id(token.user_id) do
render(conn, "reset.html", %{
token: token,
diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex
index 5d7948507..8e20b0d55 100644
--- a/lib/pleroma/web/twitter_api/twitter_api.ex
+++ b/lib/pleroma/web/twitter_api/twitter_api.ex
@@ -45,7 +45,6 @@ defp create_user(params, opts) do
case User.register(changeset) do
{:ok, user} ->
- maybe_notify_admins(user)
{:ok, user}
{:error, changeset} ->
@@ -58,18 +57,6 @@ defp create_user(params, opts) do
end
end
- defp maybe_notify_admins(%User{} = account) do
- if Pleroma.Config.get([:instance, :account_approval_required]) do
- User.all_superusers()
- |> Enum.filter(fn user -> not is_nil(user.email) end)
- |> Enum.each(fn superuser ->
- superuser
- |> Pleroma.Emails.AdminEmail.new_unapproved_registration(account)
- |> Pleroma.Emails.Mailer.deliver_async()
- end)
- end
- end
-
def password_reset(nickname_or_email) do
with true <- is_binary(nickname_or_email),
%User{local: true, email: email, deactivated: false} = user when is_binary(email) <-
diff --git a/lib/pleroma/web/views/streamer_view.ex b/lib/pleroma/web/views/streamer_view.ex
index 476a33245..4fc14166d 100644
--- a/lib/pleroma/web/views/streamer_view.ex
+++ b/lib/pleroma/web/views/streamer_view.ex
@@ -74,6 +74,28 @@ def render("chat_update.json", %{chat_message_reference: cm_ref}) do
|> Jason.encode!()
end
+ def render("follow_relationships_update.json", item) do
+ %{
+ event: "pleroma:follow_relationships_update",
+ payload:
+ %{
+ state: item.state,
+ follower: %{
+ id: item.follower.id,
+ follower_count: item.follower.follower_count,
+ following_count: item.follower.following_count
+ },
+ following: %{
+ id: item.following.id,
+ follower_count: item.following.follower_count,
+ following_count: item.following.following_count
+ }
+ }
+ |> Jason.encode!()
+ }
+ |> Jason.encode!()
+ end
+
def render("conversation.json", %Participation{} = participation) do
%{
event: "conversation",
diff --git a/lib/pleroma/web/web_finger.ex b/lib/pleroma/web/web_finger.ex
index 6629f5356..a109e1acc 100644
--- a/lib/pleroma/web/web_finger.ex
+++ b/lib/pleroma/web/web_finger.ex
@@ -58,12 +58,16 @@ defp gather_links(%User{} = user) do
] ++ Publisher.gather_webfinger_links(user)
end
+ defp gather_aliases(%User{} = user) do
+ [user.ap_id | user.also_known_as]
+ end
+
def represent_user(user, "JSON") do
{:ok, user} = User.ensure_keys_present(user)
%{
"subject" => "acct:#{user.nickname}@#{Pleroma.Web.Endpoint.host()}",
- "aliases" => [user.ap_id],
+ "aliases" => gather_aliases(user),
"links" => gather_links(user)
}
end
@@ -71,6 +75,11 @@ def represent_user(user, "JSON") do
def represent_user(user, "XML") do
{:ok, user} = User.ensure_keys_present(user)
+ aliases =
+ user
+ |> gather_aliases()
+ |> Enum.map(&{:Alias, &1})
+
links =
gather_links(user)
|> Enum.map(fn link -> {:Link, link} end)
@@ -79,9 +88,8 @@ def represent_user(user, "XML") do
:XRD,
%{xmlns: "http://docs.oasis-open.org/ns/xri/xrd-1.0"},
[
- {:Subject, "acct:#{user.nickname}@#{Pleroma.Web.Endpoint.host()}"},
- {:Alias, user.ap_id}
- ] ++ links
+ {:Subject, "acct:#{user.nickname}@#{Pleroma.Web.Endpoint.host()}"}
+ ] ++ aliases ++ links
}
|> XmlBuilder.to_doc()
end
@@ -116,6 +124,9 @@ defp webfinger_from_json(doc) do
{"application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "self"} ->
Map.put(data, "ap_id", link["href"])
+ {nil, "http://ostatus.org/schema/1.0/subscribe"} ->
+ Map.put(data, "subscribe_address", link["template"])
+
_ ->
Logger.debug("Unhandled type: #{inspect(link["type"])}")
data
diff --git a/lib/pleroma/workers/background_worker.ex b/lib/pleroma/workers/background_worker.ex
index 55b5a13d9..0647c65ae 100644
--- a/lib/pleroma/workers/background_worker.ex
+++ b/lib/pleroma/workers/background_worker.ex
@@ -3,9 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.BackgroundWorker do
- alias Pleroma.Activity
alias Pleroma.User
- alias Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy
use Pleroma.Workers.WorkerHelper, queue: "background"
@@ -32,19 +30,6 @@ def perform(%Job{args: %{"op" => op, "user_id" => user_id, "identifiers" => iden
{:ok, User.Import.perform(String.to_atom(op), user, identifiers)}
end
- def perform(%Job{args: %{"op" => "media_proxy_preload", "message" => message}}) do
- MediaProxyWarmingPolicy.perform(:preload, message)
- end
-
- def perform(%Job{args: %{"op" => "media_proxy_prefetch", "url" => url}}) do
- MediaProxyWarmingPolicy.perform(:prefetch, url)
- end
-
- def perform(%Job{args: %{"op" => "fetch_data_for_activity", "activity_id" => activity_id}}) do
- activity = Activity.get_by_id(activity_id)
- Pleroma.Web.RichMedia.Helpers.perform(:fetch, activity)
- end
-
def perform(%Job{
args: %{"op" => "move_following", "origin_id" => origin_id, "target_id" => target_id}
}) do
diff --git a/lib/pleroma/workers/mute_expire_worker.ex b/lib/pleroma/workers/mute_expire_worker.ex
new file mode 100644
index 000000000..32a12ba85
--- /dev/null
+++ b/lib/pleroma/workers/mute_expire_worker.ex
@@ -0,0 +1,20 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Workers.MuteExpireWorker do
+ use Pleroma.Workers.WorkerHelper, queue: "mute_expire"
+
+ @impl Oban.Worker
+ def perform(%Job{args: %{"op" => "unmute_user", "muter_id" => muter_id, "mutee_id" => mutee_id}}) do
+ Pleroma.User.unmute(muter_id, mutee_id)
+ :ok
+ end
+
+ def perform(%Job{
+ args: %{"op" => "unmute_conversation", "user_id" => user_id, "activity_id" => activity_id}
+ }) do
+ Pleroma.Web.CommonAPI.remove_mute(user_id, activity_id)
+ :ok
+ end
+end
diff --git a/mix.exs b/mix.exs
index 0691902a6..f26a5391a 100644
--- a/mix.exs
+++ b/mix.exs
@@ -4,7 +4,7 @@ defmodule Pleroma.Mixfile do
def project do
[
app: :pleroma,
- version: version("2.1.50"),
+ version: version("2.2.50"),
elixir: "~> 1.9",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
@@ -22,7 +22,7 @@ def project do
docs: [
source_url_pattern:
"https://git.pleroma.social/pleroma/pleroma/blob/develop/%{path}#L%{line}",
- logo: "priv/static/static/logo.png",
+ logo: "priv/static/images/logo.png",
extras: ["README.md", "CHANGELOG.md"] ++ Path.wildcard("docs/**/*.md"),
groups_for_extras: [
"Installation manuals": Path.wildcard("docs/installation/*.md"),
@@ -37,7 +37,8 @@ def project do
pleroma: [
include_executables_for: [:unix],
applications: [ex_syslogger: :load, syslog: :load, eldap: :transient],
- steps: [:assemble, &put_otp_version/1, ©_files/1, ©_nginx_config/1]
+ steps: [:assemble, &put_otp_version/1, ©_files/1, ©_nginx_config/1],
+ config_providers: [{Pleroma.Config.ReleaseRuntimeProvider, nil}]
]
]
]
@@ -133,24 +134,21 @@ defp deps do
{:calendar, "~> 1.0"},
{:cachex, "~> 3.2"},
{:poison, "~> 3.0", override: true},
- {:tesla,
- git: "https://github.com/teamon/tesla.git",
- ref: "9f7261ca49f9f901ceb73b60219ad6f8a9f6aa30",
- override: true},
+ {:tesla, "~> 1.4.0", override: true},
{:castore, "~> 0.1"},
{:cowlib, "~> 2.9", override: true},
{:gun,
github: "ninenines/gun", ref: "921c47146b2d9567eac7e9a4d2ccc60fffd4f327", override: true},
{:jason, "~> 1.2"},
{:mogrify, "~> 0.7.4"},
- {:ex_aws, "~> 2.1"},
+ {:ex_aws, "~> 2.1.6"},
{:ex_aws_s3, "~> 2.0"},
{:sweet_xml, "~> 0.6.6"},
{:earmark, "1.4.3"},
{:bbcode_pleroma, "~> 0.2.0"},
{:crypt,
- git: "https://github.com/msantos/crypt.git",
- ref: "f63a705f92c26955977ee62a313012e309a4d77a"},
+ git: "https://git.pleroma.social/pleroma/elixir-libraries/crypt.git",
+ ref: "cf2aa3f11632e8b0634810a15b3e612c7526f6a3"},
{:cors_plug, "~> 2.0"},
{:web_push_encryption, "~> 0.3"},
{:swoosh, "~> 1.0"},
@@ -160,7 +158,7 @@ defp deps do
{:floki, "~> 0.27"},
{:timex, "~> 3.6"},
{:ueberauth, "~> 0.4"},
- {:linkify, "~> 0.2.0"},
+ {:linkify, "~> 0.4.1"},
{:http_signatures, "~> 0.1.0"},
{:telemetry, "~> 0.3"},
{:poolboy, "~> 1.5"},
@@ -196,7 +194,8 @@ defp deps do
ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"},
{:restarter, path: "./restarter"},
{:majic,
- git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", branch: "develop"},
+ git: "https://git.pleroma.social/pleroma/elixir-libraries/majic.git",
+ ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"},
{:open_api_spex,
git: "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git",
ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"},
@@ -208,8 +207,11 @@ defp deps do
{:mock, "~> 0.3.5", only: :test},
# temporary downgrade for excoveralls, hackney until hackney max_connections bug will be fixed
{:excoveralls, "0.12.3", only: :test},
- {:hackney, "1.15.2", override: true},
- {:mox, "~> 0.5", only: :test},
+ {:hackney,
+ git: "https://git.pleroma.social/pleroma/elixir-libraries/hackney.git",
+ ref: "7d7119f0651515d6d7669c78393fd90950a3ec6e",
+ override: true},
+ {:mox, "~> 1.0", only: :test},
{:websocket_client, git: "https://github.com/jeremyong/websocket_client.git", only: :test}
] ++ oauth_deps()
end
diff --git a/mix.lock b/mix.lock
index e5d9bc693..01caf319e 100644
--- a/mix.lock
+++ b/mix.lock
@@ -11,7 +11,7 @@
"calendar": {:hex, :calendar, "1.0.0", "f52073a708528482ec33d0a171954ca610fe2bd28f1e871f247dc7f1565fa807", [:mix], [{:tzdata, "~> 0.5.20 or ~> 0.1.201603 or ~> 1.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "990e9581920c82912a5ee50e62ff5ef96da6b15949a2ee4734f935fdef0f0a6f"},
"captcha": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/elixir-captcha.git", "e0f16822d578866e186a0974d65ad58cddc1e2ab", [ref: "e0f16822d578866e186a0974d65ad58cddc1e2ab"]},
"castore": {:hex, :castore, "0.1.7", "1ca19eee705cde48c9e809e37fdd0730510752cc397745e550f6065a56a701e9", [:mix], [], "hexpm", "a2ae2c13d40e9c308387f1aceb14786dca019ebc2a11484fb2a9f797ea0aa0d8"},
- "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "805abd97539caf89ec6d4732c91e62ba9da0cda51ac462380bbd28ee697a8c42"},
+ "certifi": {:git, "https://github.com/certifi/erlang-certifi", "e08b12e8993502240c25b78563993776f87ecd2a", [tag: "2.5.1"]},
"combine": {:hex, :combine, "0.10.0", "eff8224eeb56498a2af13011d142c5e7997a80c8f5b97c499f84c841032e429f", [:mix], [], "hexpm", "1b1dbc1790073076580d0d1d64e42eae2366583e7aecd455d1215b0d16f2451b"},
"comeonin": {:hex, :comeonin, "5.3.1", "7fe612b739c78c9c1a75186ef2d322ce4d25032d119823269d0aa1e2f1e20025", [:mix], [], "hexpm", "d6222483060c17f0977fad1b7401ef0c5863c985a64352755f366aee3799c245"},
"concurrent_limiter": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/concurrent_limiter.git", "d81be41024569330f296fc472e24198d7499ba78", [ref: "d81be41024569330f296fc472e24198d7499ba78"]},
@@ -22,7 +22,7 @@
"cowlib": {:hex, :cowlib, "2.9.1", "61a6c7c50cf07fdd24b2f45b89500bb93b6686579b069a89f88cb211e1125c78", [:rebar3], [], "hexpm", "e4175dc240a70d996156160891e1c62238ede1729e45740bdd38064dad476170"},
"credo": {:hex, :credo, "1.4.1", "16392f1edd2cdb1de9fe4004f5ab0ae612c92e230433968eab00aafd976282fc", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "155f8a2989ad77504de5d8291fa0d41320fdcaa6a1030472e9967f285f8c7692"},
"crontab": {:hex, :crontab, "1.1.8", "2ce0e74777dfcadb28a1debbea707e58b879e6aa0ffbf9c9bb540887bce43617", [:mix], [{:ecto, "~> 1.0 or ~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: true]}], "hexpm"},
- "crypt": {:git, "https://github.com/msantos/crypt.git", "f63a705f92c26955977ee62a313012e309a4d77a", [ref: "f63a705f92c26955977ee62a313012e309a4d77a"]},
+ "crypt": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/crypt.git", "cf2aa3f11632e8b0634810a15b3e612c7526f6a3", [ref: "cf2aa3f11632e8b0634810a15b3e612c7526f6a3"]},
"custom_base": {:hex, :custom_base, "0.2.1", "4a832a42ea0552299d81652aa0b1f775d462175293e99dfbe4d7dbaab785a706", [:mix], [], "hexpm", "8df019facc5ec9603e94f7270f1ac73ddf339f56ade76a721eaa57c1493ba463"},
"db_connection": {:hex, :db_connection, "2.2.2", "3bbca41b199e1598245b716248964926303b5d4609ff065125ce98bcd368939e", [:mix], [{:connection, "~> 1.0.2", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "642af240d8a8affb93b4ba5a6fcd2bbcbdc327e1a524b825d383711536f8070c"},
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
@@ -33,11 +33,11 @@
"ecto_enum": {:hex, :ecto_enum, "1.4.0", "d14b00e04b974afc69c251632d1e49594d899067ee2b376277efd8233027aec8", [:mix], [{:ecto, ">= 3.0.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:ecto_sql, "> 3.0.0", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:mariaex, ">= 0.0.0", [hex: :mariaex, repo: "hexpm", optional: true]}, {:postgrex, ">= 0.0.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "8fb55c087181c2b15eee406519dc22578fa60dd82c088be376d0010172764ee4"},
"ecto_sql": {:hex, :ecto_sql, "3.4.5", "30161f81b167d561a9a2df4329c10ae05ff36eca7ccc84628f2c8b9fa1e43323", [:mix], [{:db_connection, "~> 2.2", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.4.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.3.0 or ~> 0.4.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.15.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.0", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "31990c6a3579b36a3c0841d34a94c275e727de8b84f58509da5f1b2032c98ac2"},
"eimp": {:hex, :eimp, "1.0.14", "fc297f0c7e2700457a95a60c7010a5f1dcb768a083b6d53f49cd94ab95a28f22", [:rebar3], [{:p1_utils, "1.0.18", [hex: :p1_utils, repo: "hexpm", optional: false]}], "hexpm", "501133f3112079b92d9e22da8b88bf4f0e13d4d67ae9c15c42c30bd25ceb83b6"},
- "elixir_make": {:hex, :elixir_make, "0.6.1", "8faa29a5597faba999aeeb72bbb9c91694ef8068f0131192fb199f98d32994ef", [:mix], [], "hexpm", "35d33270680f8d839a4003c3e9f43afb595310a592405a00afc12de4c7f55a18"},
+ "elixir_make": {:hex, :elixir_make, "0.6.2", "7dffacd77dec4c37b39af867cedaabb0b59f6a871f89722c25b28fcd4bd70530", [:mix], [], "hexpm", "03e49eadda22526a7e5279d53321d1cced6552f344ba4e03e619063de75348d9"},
"esshd": {:hex, :esshd, "0.1.1", "d4dd4c46698093a40a56afecce8a46e246eb35463c457c246dacba2e056f31b5", [:mix], [], "hexpm", "d73e341e3009d390aa36387dc8862860bf9f874c94d9fd92ade2926376f49981"},
"eternal": {:hex, :eternal, "1.2.1", "d5b6b2499ba876c57be2581b5b999ee9bdf861c647401066d3eeed111d096bc4", [:mix], [], "hexpm", "b14f1dc204321429479c569cfbe8fb287541184ed040956c8862cb7a677b8406"},
"ex2ms": {:hex, :ex2ms, "1.5.0", "19e27f9212be9a96093fed8cdfbef0a2b56c21237196d26760f11dfcfae58e97", [:mix], [], "hexpm"},
- "ex_aws": {:hex, :ex_aws, "2.1.3", "26b6f036f0127548706aade4a509978fc7c26bd5334b004fba9bfe2687a525df", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "0bdbe2aed9f326922fc5a6a80417e32f0c895f4b3b2b0b9676ebf23dd16c5da4"},
+ "ex_aws": {:hex, :ex_aws, "2.1.6", "41ab8b4caa48035c96d07faa035d2d9de6df480e7e084c054e662ac888dcd4d4", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8", [hex: :jsx, repo: "hexpm", optional: true]}, {:sweet_xml, "~> 0.6", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "a541bd042c1ee26412bb1e749ddf2a1c327e4fb7e382b1cd227e1b00eed3d469"},
"ex_aws_s3": {:hex, :ex_aws_s3, "2.0.2", "c0258bbdfea55de4f98f0b2f0ca61fe402cc696f573815134beb1866e778f47b", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "0569f5b211b1a3b12b705fe2a9d0e237eb1360b9d76298028df2346cad13097a"},
"ex_const": {:hex, :ex_const, "0.2.4", "d06e540c9d834865b012a17407761455efa71d0ce91e5831e86881b9c9d82448", [:mix], [], "hexpm", "96fd346610cc992b8f896ed26a98be82ac4efb065a0578f334a32d60a3ba9767"},
"ex_doc": {:hex, :ex_doc, "0.22.2", "03a2a58bdd2ba0d83d004507c4ee113b9c521956938298eba16e55cc4aba4a6c", [:mix], [{:earmark_parser, "~> 1.4.0", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "cf60e1b3e2efe317095b6bb79651f83a2c1b3edcb4d319c421d7fcda8b3aff26"},
@@ -53,30 +53,30 @@
"gen_state_machine": {:hex, :gen_state_machine, "2.0.5", "9ac15ec6e66acac994cc442dcc2c6f9796cf380ec4b08267223014be1c728a95", [:mix], [], "hexpm"},
"gettext": {:hex, :gettext, "0.18.0", "406d6b9e0e3278162c2ae1de0a60270452c553536772167e2d701f028116f870", [:mix], [], "hexpm", "c3f850be6367ebe1a08616c2158affe4a23231c70391050bf359d5f92f66a571"},
"gun": {:git, "https://github.com/ninenines/gun.git", "921c47146b2d9567eac7e9a4d2ccc60fffd4f327", [ref: "921c47146b2d9567eac7e9a4d2ccc60fffd4f327"]},
- "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "e0100f8ef7d1124222c11ad362c857d3df7cb5f4204054f9f0f4a728666591fc"},
+ "hackney": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/hackney.git", "7d7119f0651515d6d7669c78393fd90950a3ec6e", [ref: "7d7119f0651515d6d7669c78393fd90950a3ec6e"]},
"html_entities": {:hex, :html_entities, "0.5.1", "1c9715058b42c35a2ab65edc5b36d0ea66dd083767bef6e3edb57870ef556549", [:mix], [], "hexpm", "30efab070904eb897ff05cd52fa61c1025d7f8ef3a9ca250bc4e6513d16c32de"},
"html_sanitize_ex": {:hex, :html_sanitize_ex, "1.3.0", "f005ad692b717691203f940c686208aa3d8ffd9dd4bb3699240096a51fa9564e", [:mix], [{:mochiweb, "~> 2.15", [hex: :mochiweb, repo: "hexpm", optional: false]}], "hexpm"},
"http_signatures": {:hex, :http_signatures, "0.1.0", "4e4b501a936dbf4cb5222597038a89ea10781776770d2e185849fa829686b34c", [:mix], [], "hexpm", "f8a7b3731e3fd17d38fa6e343fcad7b03d6874a3b0a108c8568a71ed9c2cf824"},
"httpoison": {:hex, :httpoison, "1.6.2", "ace7c8d3a361cebccbed19c283c349b3d26991eff73a1eaaa8abae2e3c8089b6", [:mix], [{:hackney, "~> 1.15 and >= 1.15.2", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "aa2c74bd271af34239a3948779612f87df2422c2fdcfdbcec28d9c105f0773fe"},
- "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "4bdd305eb64e18b0273864920695cb18d7a2021f31a11b9c5fbcd9a253f936e2"},
+ "idna": {:git, "https://github.com/benoitc/erlang-idna", "6cff72747821110169ecfac871b0c69e5064afff", [tag: "6.0.0"]},
"inet_cidr": {:hex, :inet_cidr, "1.0.4", "a05744ab7c221ca8e395c926c3919a821eb512e8f36547c062f62c4ca0cf3d6e", [:mix], [], "hexpm", "64a2d30189704ae41ca7dbdd587f5291db5d1dda1414e0774c29ffc81088c1bc"},
"jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"},
"joken": {:hex, :joken, "2.2.0", "2daa1b12be05184aff7b5ace1d43ca1f81345962285fff3f88db74927c954d3a", [:mix], [{:jose, "~> 1.9", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "b4f92e30388206f869dd25d1af628a1d99d7586e5cf0672f64d4df84c4d2f5e9"},
"jose": {:hex, :jose, "1.10.1", "16d8e460dae7203c6d1efa3f277e25b5af8b659febfc2f2eb4bacf87f128b80a", [:mix, :rebar3], [], "hexpm", "3c7ddc8a9394b92891db7c2771da94bf819834a1a4c92e30857b7d582e2f8257"},
"jumper": {:hex, :jumper, "1.0.1", "3c00542ef1a83532b72269fab9f0f0c82bf23a35e27d278bfd9ed0865cecabff", [:mix], [], "hexpm", "318c59078ac220e966d27af3646026db9b5a5e6703cb2aa3e26bcfaba65b7433"},
"libring": {:hex, :libring, "1.4.0", "41246ba2f3fbc76b3971f6bce83119dfec1eee17e977a48d8a9cfaaf58c2a8d6", [:mix], [], "hexpm"},
- "linkify": {:hex, :linkify, "0.2.0", "2518bbbea21d2caa9d372424e1ad845b640c6630e2d016f1bd1f518f9ebcca28", [:mix], [], "hexpm", "b8ca8a68b79e30b7938d6c996085f3db14939f29538a59ca5101988bb7f917f6"},
- "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "4c692e544b28d1f5e543fb8a44be090f8cd96f80", [branch: "develop"]},
+ "linkify": {:hex, :linkify, "0.4.1", "f881eb3429ae88010cf736e6fb3eed406c187bcdd544902ec937496636b7c7b3", [:mix], [], "hexpm", "ce98693f54ae9ace59f2f7a8aed3de2ef311381a8ce7794804bd75484c371dda"},
+ "majic": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/majic.git", "4c692e544b28d1f5e543fb8a44be090f8cd96f80", [ref: "4c692e544b28d1f5e543fb8a44be090f8cd96f80"]},
"makeup": {:hex, :makeup, "1.0.3", "e339e2f766d12e7260e6672dd4047405963c5ec99661abdc432e6ec67d29ef95", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "2e9b4996d11832947731f7608fed7ad2f9443011b3b479ae288011265cdd3dad"},
"makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"},
"meck": {:hex, :meck, "0.8.13", "ffedb39f99b0b99703b8601c6f17c7f76313ee12de6b646e671e3188401f7866", [:rebar3], [], "hexpm", "d34f013c156db51ad57cc556891b9720e6a1c1df5fe2e15af999c84d6cebeb1a"},
- "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
+ "metrics": {:git, "https://github.com/benoitc/erlang-metrics", "c6eb4dcf29f9e907539915e2ab996f40c2ec7e8e", [tag: "1.0.1"]},
"mime": {:hex, :mime, "1.4.0", "5066f14944b470286146047d2f73518cf5cca82f8e4815cf35d196b58cf07c47", [:mix], [], "hexpm", "75fa42c4228ea9a23f70f123c74ba7cece6a03b1fd474fe13f6a7a85c6ea4ff6"},
- "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
+ "mimerl": {:git, "https://github.com/benoitc/mimerl", "5a1b22a8fada5b3b40438da00a6923cb87a42bbc", [tag: "1.2.0"]},
"mochiweb": {:hex, :mochiweb, "2.18.0", "eb55f1db3e6e960fac4e6db4e2db9ec3602cc9f30b86cd1481d56545c3145d2e", [:rebar3], [], "hexpm"},
"mock": {:hex, :mock, "0.3.5", "feb81f52b8dcf0a0d65001d2fec459f6b6a8c22562d94a965862f6cc066b5431", [:mix], [{:meck, "~> 0.8.13", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "6fae404799408300f863550392635d8f7e3da6b71abdd5c393faf41b131c8728"},
"mogrify": {:hex, :mogrify, "0.7.4", "9b2496dde44b1ce12676f85d7dc531900939e6367bc537c7243a1b089435b32d", [:mix], [], "hexpm", "50d79e337fba6bc95bfbef918058c90f50b17eed9537771e61d4619488f099c3"},
- "mox": {:hex, :mox, "0.5.2", "55a0a5ba9ccc671518d068c8dddd20eeb436909ea79d1799e2209df7eaa98b6c", [:mix], [], "hexpm", "df4310628cd628ee181df93f50ddfd07be3e5ecc30232d3b6aadf30bdfe6092b"},
+ "mox": {:hex, :mox, "1.0.0", "4b3c7005173f47ff30641ba044eb0fe67287743eec9bd9545e37f3002b0a9f8b", [:mix], [], "hexpm", "201b0a20b7abdaaab083e9cf97884950f8a30a1350a1da403b3145e213c6f4df"},
"myhtmlex": {:git, "https://git.pleroma.social/pleroma/myhtmlex.git", "ad0097e2f61d4953bfef20fb6abddf23b87111e6", [ref: "ad0097e2f61d4953bfef20fb6abddf23b87111e6", submodules: true]},
"nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"},
"nimble_pool": {:hex, :nimble_pool, "0.1.0", "ffa9d5be27eee2b00b0c634eb649aa27f97b39186fec3c493716c2a33e784ec6", [:mix], [], "hexpm", "343a1eaa620ddcf3430a83f39f2af499fe2370390d4f785cd475b4df5acaf3f9"},
@@ -84,7 +84,7 @@
"oban": {:hex, :oban, "2.1.0", "034144686f7e76a102b5d67731f098d98a9e4a52b07c25ad580a01f83a7f1cf5", [:mix], [{:ecto_sql, ">= 3.4.3", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c6f067fa3b308ed9e0e6beb2b34277c9c4e48bf95338edabd8f4a757a26e04c2"},
"open_api_spex": {:git, "https://git.pleroma.social/pleroma/elixir-libraries/open_api_spex.git", "f296ac0924ba3cf79c7a588c4c252889df4c2edd", [ref: "f296ac0924ba3cf79c7a588c4c252889df4c2edd"]},
"p1_utils": {:hex, :p1_utils, "1.0.18", "3fe224de5b2e190d730a3c5da9d6e8540c96484cf4b4692921d1e28f0c32b01c", [:rebar3], [], "hexpm", "1fc8773a71a15553b179c986b22fbeead19b28fe486c332d4929700ffeb71f88"},
- "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
+ "parse_trans": {:git, "https://github.com/uwiger/parse_trans.git", "76abb347c3c1d00fb0ccf9e4b43e22b3d2288484", [tag: "3.3.0"]},
"pbkdf2_elixir": {:hex, :pbkdf2_elixir, "1.2.1", "9cbe354b58121075bd20eb83076900a3832324b7dd171a6895fab57b6bb2752c", [:mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}], "hexpm", "d3b40a4a4630f0b442f19eca891fcfeeee4c40871936fed2f68e1c4faa30481f"},
"phoenix": {:hex, :phoenix, "1.5.6", "8298cdb4e0f943242ba8410780a6a69cbbe972fef199b341a36898dd751bdd66", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_html, "~> 2.13", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.1.2 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "0dc4d39af1306b6aa5122729b0a95ca779e42c708c6fe7abbb3d336d5379e956"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.2.1", "13f124cf0a3ce0f1948cf24654c7b9f2347169ff75c1123f44674afee6af3b03", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 2.15", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "478a1bae899cac0a6e02be1deec7e2944b7754c04e7d4107fc5a517f877743c0"},
@@ -110,17 +110,17 @@
"recon": {:hex, :recon, "2.5.1", "430ffa60685ac1efdfb1fe4c97b8767c92d0d92e6e7c3e8621559ba77598678a", [:mix, :rebar3], [], "hexpm", "5721c6b6d50122d8f68cccac712caa1231f97894bab779eff5ff0f886cb44648"},
"remote_ip": {:git, "https://git.pleroma.social/pleroma/remote_ip.git", "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8", [ref: "b647d0deecaa3acb140854fe4bda5b7e1dc6d1c8"]},
"sleeplocks": {:hex, :sleeplocks, "1.1.1", "3d462a0639a6ef36cc75d6038b7393ae537ab394641beb59830a1b8271faeed3", [:rebar3], [], "hexpm", "84ee37aeff4d0d92b290fff986d6a95ac5eedf9b383fadfd1d88e9b84a1c02e1"},
- "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm", "13104d7897e38ed7f044c4de953a6c28597d1c952075eb2e328bc6d6f2bfc496"},
+ "ssl_verify_fun": {:git, "https://github.com/deadtrickster/ssl_verify_fun.erl", "c5718226b0b9f3d1a38ef6ca3c3b4c75f53dda92", [tag: "1.1.4"]},
"sweet_xml": {:hex, :sweet_xml, "0.6.6", "fc3e91ec5dd7c787b6195757fbcf0abc670cee1e4172687b45183032221b66b8", [:mix], [], "hexpm", "2e1ec458f892ffa81f9f8386e3f35a1af6db7a7a37748a64478f13163a1f3573"},
"swoosh": {:hex, :swoosh, "1.0.6", "6765e334c67dacabe721f0d701c7e5a6f06e4595c90df6f91e73ebd54d555833", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "7c50ef78e4acfd1cbd4907dc1fa87b5540675a6be9dc979d04890f49d7ec1830"},
"syslog": {:hex, :syslog, "1.1.0", "6419a232bea84f07b56dc575225007ffe34d9fdc91abe6f1b2f254fd71d8efc2", [:rebar3], [], "hexpm", "4c6a41373c7e20587be33ef841d3de6f3beba08519809329ecc4d27b15b659e1"},
"telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"},
- "tesla": {:git, "https://github.com/teamon/tesla.git", "9f7261ca49f9f901ceb73b60219ad6f8a9f6aa30", [ref: "9f7261ca49f9f901ceb73b60219ad6f8a9f6aa30"]},
+ "tesla": {:hex, :tesla, "1.4.0", "1081bef0124b8bdec1c3d330bbe91956648fb008cf0d3950a369cda466a31a87", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:finch, "~> 0.3", [hex: :finch, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.0", [hex: :mint, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm", "bf1374a5569f5fca8e641363b63f7347d680d91388880979a33bc12a6eb3e0aa"},
"timex": {:hex, :timex, "3.6.2", "845cdeb6119e2fef10751c0b247b6c59d86d78554c83f78db612e3290f819bc2", [:mix], [{:combine, "~> 0.10", [hex: :combine, repo: "hexpm", optional: false]}, {:gettext, "~> 0.10", [hex: :gettext, repo: "hexpm", optional: false]}, {:tzdata, "~> 0.1.8 or ~> 0.5 or ~> 1.0.0", [hex: :tzdata, repo: "hexpm", optional: false]}], "hexpm", "26030b46199d02a590be61c2394b37ea25a3664c02fafbeca0b24c972025d47a"},
"trailing_format_plug": {:hex, :trailing_format_plug, "0.0.7", "64b877f912cf7273bed03379936df39894149e35137ac9509117e59866e10e45", [:mix], [{:plug, "> 0.12.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "bd4fde4c15f3e993a999e019d64347489b91b7a9096af68b2bdadd192afa693f"},
"tzdata": {:hex, :tzdata, "1.0.4", "a3baa4709ea8dba552dca165af6ae97c624a2d6ac14bd265165eaa8e8af94af6", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}], "hexpm", "b02637db3df1fd66dd2d3c4f194a81633d0e4b44308d36c1b2fdfd1e4e6f169b"},
"ueberauth": {:hex, :ueberauth, "0.6.3", "d42ace28b870e8072cf30e32e385579c57b9cc96ec74fa1f30f30da9c14f3cc0", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "afc293d8a1140d6591b53e3eaf415ca92842cb1d32fad3c450c6f045f7f91b60"},
- "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"},
+ "unicode_util_compat": {:git, "https://github.com/benoitc/unicode_util_compat.git", "38d7bc105f51159e8ea3279c40121db9db1e652f", [tag: "0.3.1"]},
"unsafe": {:hex, :unsafe, "1.0.1", "a27e1874f72ee49312e0a9ec2e0b27924214a05e3ddac90e91727bc76f8613d8", [:mix], [], "hexpm", "6c7729a2d214806450d29766abc2afaa7a2cbecf415be64f36a6691afebb50e5"},
"web_push_encryption": {:hex, :web_push_encryption, "0.3.0", "598b5135e696fd1404dc8d0d7c0fa2c027244a4e5d5e5a98ba267f14fdeaabc8", [:mix], [{:httpoison, "~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:jose, "~> 1.8", [hex: :jose, repo: "hexpm", optional: false]}], "hexpm", "f10bdd1afe527ede694749fb77a2f22f146a51b054c7fa541c9fd920fba7c875"},
"websocket_client": {:git, "https://github.com/jeremyong/websocket_client.git", "9a6f65d05ebf2725d62fb19262b21f1805a59fbf", []},
diff --git a/priv/gettext/en/LC_MESSAGES/posix_errors.po b/priv/gettext/en/LC_MESSAGES/posix_errors.po
new file mode 100644
index 000000000..4d8fbf1d3
--- /dev/null
+++ b/priv/gettext/en/LC_MESSAGES/posix_errors.po
@@ -0,0 +1,141 @@
+## This file is a PO Template file.
+msgid "eperm"
+msgstr "Operation not permitted"
+
+msgid "eacces"
+msgstr "Permission denied"
+
+msgid "eagain"
+msgstr "Resource temporarily unavailable"
+
+msgid "ebadf"
+msgstr "Bad file descriptor"
+
+msgid "ebadmsg"
+msgstr "Bad message"
+
+msgid "ebusy"
+msgstr "Device or resource busy"
+
+msgid "edeadlk"
+msgstr "Resource deadlock avoided"
+
+msgid "edeadlock"
+msgstr "Resource deadlock avoided"
+
+msgid "edquot"
+msgstr "Disk quota exceeded"
+
+msgid "eexist"
+msgstr "File exists"
+
+msgid "efault"
+msgstr "Bad address"
+
+msgid "efbig"
+msgstr "File is too large"
+
+msgid "eftype"
+msgstr "Inappropriate file type or format"
+
+msgid "eintr"
+msgstr "Interrupted system call"
+
+msgid "einval"
+msgstr "Invalid argument"
+
+msgid "eio"
+msgstr "Input/output error"
+
+msgid "eisdir"
+msgstr "Illegal operation on a directory"
+
+msgid "eloop"
+msgstr "Too many levels of symbolic links"
+
+msgid "emfile"
+msgstr "Too many open files"
+
+msgid "emlink"
+msgstr "Too many links"
+
+msgid "emultihop"
+msgstr "Multihop attempted"
+
+msgid "enametoolong"
+msgstr "File name is too long"
+
+msgid "enfile"
+msgstr "Too many open files in system"
+
+msgid "enobufs"
+msgstr "No buffer space available"
+
+msgid "enodev"
+msgstr "No such device"
+
+msgid "enolck"
+msgstr "No locks available"
+
+msgid "enolink"
+msgstr "Link has been severed"
+
+msgid "enoent"
+msgstr "No such file or directory"
+
+msgid "enomem"
+msgstr "Cannot allocate memory"
+
+msgid "enospc"
+msgstr "No space left on device"
+
+msgid "enosr"
+msgstr "Out of streams resources"
+
+msgid "enostr"
+msgstr "Device is not a stream"
+
+msgid "enosys"
+msgstr "Function not implemented"
+
+msgid "enotblk"
+msgstr "Block device required"
+
+msgid "enotdir"
+msgstr "Not a directory"
+
+msgid "enotsup"
+msgstr "Operation not supported"
+
+msgid "enxio"
+msgstr "No such device or address"
+
+msgid "eopnotsupp"
+msgstr "Operation not supported"
+
+msgid "eoverflow"
+msgstr "Value too large for defined data type"
+
+msgid "epipe"
+msgstr "Broken pipe"
+
+msgid "erange"
+msgstr "Numerical result out of range"
+
+msgid "erofs"
+msgstr "Read-only file system"
+
+msgid "espipe"
+msgstr "Illegal seek"
+
+msgid "esrch"
+msgstr "No such process"
+
+msgid "estale"
+msgstr "Stale file handle"
+
+msgid "etxtbsy"
+msgstr "Text file busy"
+
+msgid "exdev"
+msgstr "Invalid cross-device link"
diff --git a/priv/gettext/he/LC_MESSAGES/errors.po b/priv/gettext/he/LC_MESSAGES/errors.po
new file mode 100644
index 000000000..7e251383f
--- /dev/null
+++ b/priv/gettext/he/LC_MESSAGES/errors.po
@@ -0,0 +1,599 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2020-11-10 13:39+0000\n"
+"PO-Revision-Date: 2020-11-21 04:42+0000\n"
+"Last-Translator: Guy Sheffer
\n"
+"Language-Team: Hebrew \n"
+"Language: he\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=4; plural=(n == 1) ? 0 : ((n == 2) ? 1 : ((n > 10 && "
+"n % 10 == 0) ? 2 : 3));\n"
+"X-Generator: Weblate 4.0.4\n"
+
+## This file is a PO Template file.
+##
+## `msgid`s here are often extracted from source code.
+## Add new translations manually only if they're dynamic
+## translations that can't be statically extracted.
+##
+## Run `mix gettext.extract` to bring this file up to
+## date. Leave `msgstr`s empty as changing them here as no
+## effect: edit them in PO (`.po`) files instead.
+## From Ecto.Changeset.cast/4
+msgid "can't be blank"
+msgstr "לא יכול להיות ריק"
+
+## From Ecto.Changeset.unique_constraint/3
+msgid "has already been taken"
+msgstr "כבר נלקח"
+
+## From Ecto.Changeset.put_change/3
+msgid "is invalid"
+msgstr "אינו תקני"
+
+## From Ecto.Changeset.validate_format/3
+msgid "has invalid format"
+msgstr "תבנית אינה תקנית"
+
+## From Ecto.Changeset.validate_subset/3
+msgid "has an invalid entry"
+msgstr "בעל.ה רשומה לא חוקית"
+
+## From Ecto.Changeset.validate_exclusion/3
+msgid "is reserved"
+msgstr "הינו שמור"
+
+## From Ecto.Changeset.validate_confirmation/3
+msgid "does not match confirmation"
+msgstr "אינו תורם את האימות"
+
+## From Ecto.Changeset.no_assoc_constraint/3
+msgid "is still associated with this entry"
+msgstr "עדיין משויך לרשומה זו"
+
+msgid "are still associated with this entry"
+msgstr "עדיין משויכים לרשומה זו"
+
+## From Ecto.Changeset.validate_length/3
+msgid "should be %{count} character(s)"
+msgid_plural "should be %{count} character(s)"
+msgstr[0] "אחד"
+msgstr[1] "שני"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+msgid "should have %{count} item(s)"
+msgid_plural "should have %{count} item(s)"
+msgstr[0] "אחד"
+msgstr[1] "שני"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+msgid "should be at least %{count} character(s)"
+msgid_plural "should be at least %{count} character(s)"
+msgstr[0] "אחד"
+msgstr[1] "שנים"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+msgid "should have at least %{count} item(s)"
+msgid_plural "should have at least %{count} item(s)"
+msgstr[0] "אחד"
+msgstr[1] "שניים"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+msgid "should be at most %{count} character(s)"
+msgid_plural "should be at most %{count} character(s)"
+msgstr[0] "אחד"
+msgstr[1] "שניים"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+msgid "should have at most %{count} item(s)"
+msgid_plural "should have at most %{count} item(s)"
+msgstr[0] "אחד"
+msgstr[1] "שניים"
+msgstr[2] "בודדים"
+msgstr[3] "אחר"
+
+## From Ecto.Changeset.validate_number/3
+msgid "must be less than %{number}"
+msgstr "חייב להיות מתחת ל-%{number}"
+
+msgid "must be greater than %{number}"
+msgstr "חייב להיות מעל ל-%{number}"
+
+msgid "must be less than or equal to %{number}"
+msgstr "חייב להיות שווה ל-%{number}"
+
+msgid "must be greater than or equal to %{number}"
+msgstr "חייב להיות גדול או שווה ל-%{number}"
+
+msgid "must be equal to %{number}"
+msgstr "חייב להיות שווה ל-%{number}"
+
+#: lib/pleroma/web/common_api/common_api.ex:505
+#, elixir-format
+msgid "Account not found"
+msgstr "חשבון לא נמצא"
+
+#: lib/pleroma/web/common_api/common_api.ex:339
+#, elixir-format
+msgid "Already voted"
+msgstr "הצבעה כבר התבצעה"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:359
+#, elixir-format
+msgid "Bad request"
+msgstr "בקשה שגוייה"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426
+#, elixir-format
+msgid "Can't delete object"
+msgstr "לא ניתן למחוק אובייקט"
+
+#: lib/pleroma/web/controller_helper.ex:105
+#: lib/pleroma/web/controller_helper.ex:111
+#, elixir-format
+msgid "Can't display this activity"
+msgstr "לא ניתן להציג פעילות"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285
+#, elixir-format
+msgid "Can't find user"
+msgstr "לא ניתן למצוא משתמש"
+
+#: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61
+#, elixir-format
+msgid "Can't get favorites"
+msgstr "לא ניתן למצוא מועדפים"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438
+#, elixir-format
+msgid "Can't like object"
+msgstr "לא ניתן לעשות לחבב אובייקט"
+
+#: lib/pleroma/web/common_api/utils.ex:563
+#, elixir-format
+msgid "Cannot post an empty status without attachments"
+msgstr "לא ניתן לשלוח סטטוס ריק ללא קבצים מצורפים"
+
+#: lib/pleroma/web/common_api/utils.ex:511
+#, elixir-format
+msgid "Comment must be up to %{max_size} characters"
+msgstr "תגובה חייבת להיות עד %{max_size} תווים"
+
+#: lib/pleroma/config/config_db.ex:191
+#, elixir-format
+msgid "Config with params %{params} not found"
+msgstr "הגדרה עם פרמטר %{params} לא נמצאה"
+
+#: lib/pleroma/web/common_api/common_api.ex:181
+#: lib/pleroma/web/common_api/common_api.ex:185
+#, elixir-format
+msgid "Could not delete"
+msgstr "לא ניתן למחוק"
+
+#: lib/pleroma/web/common_api/common_api.ex:231
+#, elixir-format
+msgid "Could not favorite"
+msgstr "לא ניתן לחבב"
+
+#: lib/pleroma/web/common_api/common_api.ex:453
+#, elixir-format
+msgid "Could not pin"
+msgstr "לא ניתן לנעוץ"
+
+#: lib/pleroma/web/common_api/common_api.ex:278
+#, elixir-format
+msgid "Could not unfavorite"
+msgstr "לא ניתן להסיר חיבוב"
+
+#: lib/pleroma/web/common_api/common_api.ex:463
+#, elixir-format
+msgid "Could not unpin"
+msgstr "לא ניתן לבטל נעיצה"
+
+#: lib/pleroma/web/common_api/common_api.ex:216
+#, elixir-format
+msgid "Could not unrepeat"
+msgstr "לא ניתן לבטל חזרה"
+
+#: lib/pleroma/web/common_api/common_api.ex:512
+#: lib/pleroma/web/common_api/common_api.ex:521
+#, elixir-format
+msgid "Could not update state"
+msgstr "לא ניתן לעדכן מצב"
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207
+#, elixir-format
+msgid "Error."
+msgstr "שגיאה."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:106
+#, elixir-format
+msgid "Invalid CAPTCHA"
+msgstr "CAPTCHA לא תקין"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116
+#: lib/pleroma/web/oauth/oauth_controller.ex:568
+#, elixir-format
+msgid "Invalid credentials"
+msgstr "נתוני אימות לא נכונים"
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:38
+#, elixir-format
+msgid "Invalid credentials."
+msgstr "נתוני אימות לא נכונים."
+
+#: lib/pleroma/web/common_api/common_api.ex:355
+#, elixir-format
+msgid "Invalid indices"
+msgstr "אינדקס לא תקין"
+
+#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid parameters"
+msgstr "פרמטרים לא תקינים"
+
+#: lib/pleroma/web/common_api/utils.ex:414
+#, elixir-format
+msgid "Invalid password."
+msgstr "סיסמה לא תקינה."
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220
+#, elixir-format
+msgid "Invalid request"
+msgstr "בקשה לא תקינה"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:109
+#, elixir-format
+msgid "Kocaptcha service unavailable"
+msgstr "שירות Kocaptcha לא זמין"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112
+#, elixir-format
+msgid "Missing parameters"
+msgstr "פרמטרים חסרים"
+
+#: lib/pleroma/web/common_api/utils.ex:547
+#, elixir-format
+msgid "No such conversation"
+msgstr "שיחה לא קיימת"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456
+#, elixir-format
+msgid "No such permission_group"
+msgstr "permission_group לא קיים"
+
+#: lib/pleroma/plugs/uploaded_media.ex:84
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11
+#: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143
+#, elixir-format
+msgid "Not found"
+msgstr "לא נמצא"
+
+#: lib/pleroma/web/common_api/common_api.ex:331
+#, elixir-format
+msgid "Poll's author can't vote"
+msgstr "מחבר הסקר לא יכול.ה להצביע"
+
+#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:50 lib/pleroma/web/mastodon_api/controllers/status_controller.ex:306
+#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71
+#, elixir-format
+msgid "Record not found"
+msgstr "רשומה לא נמצאה"
+
+#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35
+#: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36
+#: lib/pleroma/web/ostatus/ostatus_controller.ex:149
+#, elixir-format
+msgid "Something went wrong"
+msgstr "משהו השתבש"
+
+#: lib/pleroma/web/common_api/activity_draft.ex:107
+#, elixir-format
+msgid "The message visibility must be direct"
+msgstr "הנראות של ההודעה חייבת להיות ישירה"
+
+#: lib/pleroma/web/common_api/utils.ex:573
+#, elixir-format
+msgid "The status is over the character limit"
+msgstr "הסטטוס מעל להגבלת התווים"
+
+#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31
+#, elixir-format
+msgid "This resource requires authentication."
+msgstr "המשאב הזה דורש הרשאה."
+
+#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
+#, elixir-format
+msgid "Throttled"
+msgstr "מושנק"
+
+#: lib/pleroma/web/common_api/common_api.ex:356
+#, elixir-format
+msgid "Too many choices"
+msgstr "יותר מדיי אפשרויות"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443
+#, elixir-format
+msgid "Unhandled activity type"
+msgstr "אין התמודדות לסוג הפעילות"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485
+#, elixir-format
+msgid "You can't revoke your own admin status."
+msgstr "לא ניתן לבטל את הרשאת המנהל של עצמך."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:221
+#: lib/pleroma/web/oauth/oauth_controller.ex:308
+#, elixir-format
+msgid "Your account is currently disabled"
+msgstr "החשבון שלך כרגע מבוטל"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:183
+#: lib/pleroma/web/oauth/oauth_controller.ex:331
+#, elixir-format
+msgid "Your login is missing a confirmed e-mail address"
+msgstr "חסר לחשבון שלך כתובת דואר אלקטרוני מאושר"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390
+#, elixir-format
+msgid "can't read inbox of %{nickname} as %{as_nickname}"
+msgstr "לא ניתן לקרוא את הדואר הנכנס של %{nickname} בתור %{as_nickname}"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473
+#, elixir-format
+msgid "can't update outbox of %{nickname} as %{as_nickname}"
+msgstr "לא ניתן לעדכן את חשבון הדואר היוצא של %{nickname} בתור %{as_nickname}"
+
+#: lib/pleroma/web/common_api/common_api.ex:471
+#, elixir-format
+msgid "conversation is already muted"
+msgstr "שיחה כבר הושתקה"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492
+#, elixir-format
+msgid "error"
+msgstr "שגיאה"
+
+#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32
+#, elixir-format
+msgid "mascots can only be images"
+msgstr "קמע יכול להיות רק תמונות"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62
+#, elixir-format
+msgid "not found"
+msgstr "לא נמצא"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:394
+#, elixir-format
+msgid "Bad OAuth request."
+msgstr "בקשת OAuth שגוייה."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:115
+#, elixir-format
+msgid "CAPTCHA already used"
+msgstr "כבר נעשה שימוש ב-CAPTCHA הזה"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:112
+#, elixir-format
+msgid "CAPTCHA expired"
+msgstr "פג תוקף CAPTCHA"
+
+#: lib/pleroma/plugs/uploaded_media.ex:57
+#, elixir-format
+msgid "Failed"
+msgstr "נכשל"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:410
+#, elixir-format
+msgid "Failed to authenticate: %{message}."
+msgstr "נכשל האימות: %{message}."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:441
+#, elixir-format
+msgid "Failed to set up user account."
+msgstr "הגדרת חשבון משתמש נכשלה."
+
+#: lib/pleroma/plugs/oauth_scopes_plug.ex:38
+#, elixir-format
+msgid "Insufficient permissions: %{permissions}."
+msgstr "אין מספיק הרשאות: %{permissions}."
+
+#: lib/pleroma/plugs/uploaded_media.ex:104
+#, elixir-format
+msgid "Internal Error"
+msgstr "שגיאה פנימית"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:22
+#: lib/pleroma/web/oauth/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid Username/Password"
+msgstr "שם משתמש/סיסמה שגויים"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:118
+#, elixir-format
+msgid "Invalid answer data"
+msgstr "תשובה שגוייה למידע"
+
+#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33
+#, elixir-format
+msgid "Nodeinfo schema version not handled"
+msgstr "Nodeinfo של של גרסת הסכמה לא ניתן לטיפול"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:172
+#, elixir-format
+msgid "This action is outside the authorized scopes"
+msgstr "הפעולה הזו מחוץ לתחומי ההרשאות"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:14
+#, elixir-format
+msgid "Unknown error, please check the details and try again."
+msgstr "שגיאה לא ידועה, יש לבדוק את פרטים ולנסות שוב."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:119
+#: lib/pleroma/web/oauth/oauth_controller.ex:158
+#, elixir-format
+msgid "Unlisted redirect_uri."
+msgstr "ניתב redirect_uri לא רשום."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:390
+#, elixir-format
+msgid "Unsupported OAuth provider: %{provider}."
+msgstr "ספק OAuth לא נתמך: %{provider}."
+
+#: lib/pleroma/uploaders/uploader.ex:72
+#, elixir-format
+msgid "Uploader callback timeout"
+msgstr "קריאה חזרה של מעלה עברה את הזמן הקצוב"
+
+#: lib/pleroma/web/uploader_controller.ex:23
+#, elixir-format
+msgid "bad request"
+msgstr "בקשה שגוייה"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:103
+#, elixir-format
+msgid "CAPTCHA Error"
+msgstr "שגיאת CAPTCHA"
+
+#: lib/pleroma/web/common_api/common_api.ex:290
+#, elixir-format
+msgid "Could not add reaction emoji"
+msgstr "לא ניתן להוסיף סמלון תגובה"
+
+#: lib/pleroma/web/common_api/common_api.ex:301
+#, elixir-format
+msgid "Could not remove reaction emoji"
+msgstr "לא ניתן להסיר סמלון תגובה"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:129
+#, elixir-format
+msgid "Invalid CAPTCHA (Missing parameter: %{name})"
+msgstr "CAPTCHA לא תקני (חסר פרמטר: %{name})"
+
+#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92
+#, elixir-format
+msgid "List not found"
+msgstr "רשימה לא נמצאה"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123
+#, elixir-format
+msgid "Missing parameter: %{name}"
+msgstr "חסר פרמטר: %{name}"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:210
+#: lib/pleroma/web/oauth/oauth_controller.ex:321
+#, elixir-format
+msgid "Password reset is required"
+msgstr "נדרש איפוס סיסמה"
+
+#: lib/pleroma/tests/auth_test_controller.ex:9
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/config_controller.ex:6 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/invite_controller.ex:6 lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex:6 lib/pleroma/web/admin_api/controllers/relay_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/report_controller.ex:6 lib/pleroma/web/admin_api/controllers/status_controller.ex:6
+#: lib/pleroma/web/controller_helper.ex:6 lib/pleroma/web/embed_controller.ex:6
+#: lib/pleroma/web/fallback_redirect_controller.ex:6 lib/pleroma/web/feed/tag_controller.ex:6
+#: lib/pleroma/web/feed/user_controller.ex:6 lib/pleroma/web/mailer/subscription_controller.ex:2
+#: lib/pleroma/web/masto_fe_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/account_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/app_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/auth_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/filter_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/instance_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/list_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/marker_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:14
+#: lib/pleroma/web/mastodon_api/controllers/media_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/notification_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/report_controller.ex:8
+#: lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/search_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/status_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:7
+#: lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:6
+#: lib/pleroma/web/media_proxy/media_proxy_controller.ex:6 lib/pleroma/web/mongooseim/mongoose_im_controller.ex:6
+#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:6 lib/pleroma/web/oauth/fallback_controller.ex:6
+#: lib/pleroma/web/oauth/mfa_controller.ex:10 lib/pleroma/web/oauth/oauth_controller.ex:6
+#: lib/pleroma/web/ostatus/ostatus_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/account_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:5 lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:2 lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/notification_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex:7 lib/pleroma/web/static_fe/static_fe_controller.ex:6
+#: lib/pleroma/web/twitter_api/controllers/password_controller.ex:10 lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex:6
+#: lib/pleroma/web/twitter_api/controllers/util_controller.ex:6 lib/pleroma/web/twitter_api/twitter_api_controller.ex:6
+#: lib/pleroma/web/uploader_controller.ex:6 lib/pleroma/web/web_finger/web_finger_controller.ex:6
+#, elixir-format
+msgid "Security violation: OAuth scopes check was neither handled nor explicitly skipped."
+msgstr "הפרת אבטחה: OAuth בבדיקת המתחם לא נבדקה או דולגה במכוון."
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28
+#, elixir-format
+msgid "Two-factor authentication enabled, you must use a access token."
+msgstr "אימות דו-שלבי הופעל, יש להזין אסימון כניסה."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210
+#, elixir-format
+msgid "Unexpected error occurred while adding file to pack."
+msgstr "אירעה שגיאה לא צפויה בזמן הוספת הקובץ לחבילה."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138
+#, elixir-format
+msgid "Unexpected error occurred while creating pack."
+msgstr "אירעה שגיאה לא צפויה בזמן יצירת חבילה."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278
+#, elixir-format
+msgid "Unexpected error occurred while removing file from pack."
+msgstr "אירעה שגיאה לא צפויה בזמן הסרת הקובץ מהחבילה."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250
+#, elixir-format
+msgid "Unexpected error occurred while updating file in pack."
+msgstr "אירעה שגיאה לא צפויה בזמן עדכון הקובץ מהחבילה."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179
+#, elixir-format
+msgid "Unexpected error occurred while updating pack metadata."
+msgstr "אירעה שגיאה לא צפויה בזמן עדכון מטא-דאטה של החבילה."
+
+#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61
+#, elixir-format
+msgid "Web push subscription is disabled on this Pleroma instance"
+msgstr "הרשמה לעדכון ווב בדחיפה מבוטלת בשרת פלרומה זה"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451
+#, elixir-format
+msgid "You can't revoke your own admin/moderator status."
+msgstr "לא ניתן לשלול את סטטוס האדמין/מנהל של עצמך."
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126
+#, elixir-format
+msgid "authorization required for timeline view"
+msgstr "הרשאה דרושה על מנת לצפות בציר הזמן"
+
+#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24
+#, elixir-format
+msgid "Access denied"
+msgstr "גישה נדחית"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282
+#, elixir-format
+msgid "This API requires an authenticated user"
+msgstr "ה-API דורש הרשאת משתמש"
+
+#: lib/pleroma/plugs/user_is_admin_plug.ex:21
+#, elixir-format
+msgid "User is not an admin."
+msgstr "משתמש אינו מנהל."
diff --git a/priv/gettext/posix_errors.pot b/priv/gettext/posix_errors.pot
new file mode 100644
index 000000000..c9f593944
--- /dev/null
+++ b/priv/gettext/posix_errors.pot
@@ -0,0 +1,149 @@
+## This file is a PO Template file.
+##
+## `msgid`s here are often extracted from source code.
+## Add new translations manually only if they're dynamic
+## translations that can't be statically extracted.
+##
+## Run `mix gettext.extract` to bring this file up to
+## date. Leave `msgstr`s empty as changing them here as no
+## effect: edit them in PO (`.po`) files instead.
+msgid "eperm"
+msgstr ""
+
+msgid "eacces"
+msgstr ""
+
+msgid "eagain"
+msgstr ""
+
+msgid "ebadf"
+msgstr ""
+
+msgid "ebadmsg"
+msgstr ""
+
+msgid "ebusy"
+msgstr ""
+
+msgid "edeadlk"
+msgstr ""
+
+msgid "edeadlock"
+msgstr ""
+
+msgid "edquot"
+msgstr ""
+
+msgid "eexist"
+msgstr ""
+
+msgid "efault"
+msgstr ""
+
+msgid "efbig"
+msgstr ""
+
+msgid "eftype"
+msgstr ""
+
+msgid "eintr"
+msgstr ""
+
+msgid "einval"
+msgstr ""
+
+msgid "eio"
+msgstr ""
+
+msgid "eisdir"
+msgstr ""
+
+msgid "eloop"
+msgstr ""
+
+msgid "emfile"
+msgstr ""
+
+msgid "emlink"
+msgstr ""
+
+msgid "emultihop"
+msgstr ""
+
+msgid "enametoolong"
+msgstr ""
+
+msgid "enfile"
+msgstr ""
+
+msgid "enobufs"
+msgstr ""
+
+msgid "enodev"
+msgstr ""
+
+msgid "enolck"
+msgstr ""
+
+msgid "enolink"
+msgstr ""
+
+msgid "enoent"
+msgstr ""
+
+msgid "enomem"
+msgstr ""
+
+msgid "enospc"
+msgstr ""
+
+msgid "enosr"
+msgstr ""
+
+msgid "enostr"
+msgstr ""
+
+msgid "enosys"
+msgstr ""
+
+msgid "enotblk"
+msgstr ""
+
+msgid "enotdir"
+msgstr ""
+
+msgid "enotsup"
+msgstr ""
+
+msgid "enxio"
+msgstr ""
+
+msgid "eopnotsupp"
+msgstr ""
+
+msgid "eoverflow"
+msgstr ""
+
+msgid "epipe"
+msgstr ""
+
+msgid "erange"
+msgstr ""
+
+msgid "erofs"
+msgstr ""
+
+msgid "espipe"
+msgstr ""
+
+msgid "esrch"
+msgstr ""
+
+msgid "estale"
+msgstr ""
+
+msgid "etxtbsy"
+msgstr ""
+
+msgid "exdev"
+msgstr ""
diff --git a/priv/gettext/uk/LC_MESSAGES/errors.po b/priv/gettext/uk/LC_MESSAGES/errors.po
new file mode 100644
index 000000000..9638761ec
--- /dev/null
+++ b/priv/gettext/uk/LC_MESSAGES/errors.po
@@ -0,0 +1,599 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2020-12-10 16:09+0000\n"
+"PO-Revision-Date: 2020-12-11 00:56+0000\n"
+"Last-Translator: ZEN \n"
+"Language-Team: Ukrainian \n"
+"Language: uk\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<="
+"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
+"X-Generator: Weblate 4.0.4\n"
+
+## This file is a PO Template file.
+##
+## `msgid`s here are often extracted from source code.
+## Add new translations manually only if they're dynamic
+## translations that can't be statically extracted.
+##
+## Run `mix gettext.extract` to bring this file up to
+## date. Leave `msgstr`s empty as changing them here as no
+## effect: edit them in PO (`.po`) files instead.
+## From Ecto.Changeset.cast/4
+msgid "can't be blank"
+msgstr "не може бути пустим"
+
+## From Ecto.Changeset.unique_constraint/3
+msgid "has already been taken"
+msgstr "вже зайнято"
+
+## From Ecto.Changeset.put_change/3
+msgid "is invalid"
+msgstr "недійсний"
+
+## From Ecto.Changeset.validate_format/3
+msgid "has invalid format"
+msgstr "має недійсний формат"
+
+## From Ecto.Changeset.validate_subset/3
+msgid "has an invalid entry"
+msgstr "має недійсний запис"
+
+## From Ecto.Changeset.validate_exclusion/3
+msgid "is reserved"
+msgstr "зарезервовано"
+
+## From Ecto.Changeset.validate_confirmation/3
+msgid "does not match confirmation"
+msgstr "не збігається з підтвердженням"
+
+## From Ecto.Changeset.no_assoc_constraint/3
+msgid "is still associated with this entry"
+msgstr "все ще пов'язаний з цим записом"
+
+msgid "are still associated with this entry"
+msgstr "все ще пов'язані з цим записом"
+
+## From Ecto.Changeset.validate_length/3
+msgid "should be %{count} character(s)"
+msgid_plural "should be %{count} character(s)"
+msgstr[0] "повинен містити %{count} символ"
+msgstr[1] "повинен містити %{count} символи"
+msgstr[2] "повинен містити %{count} символів"
+
+msgid "should have %{count} item(s)"
+msgid_plural "should have %{count} item(s)"
+msgstr[0] "повинен містити %{count} елемент"
+msgstr[1] "повинен містити %{count} елементи"
+msgstr[2] "повинен містити %{count} елементів"
+
+msgid "should be at least %{count} character(s)"
+msgid_plural "should be at least %{count} character(s)"
+msgstr[0] "повинен містити хоча б %{count} символ"
+msgstr[1] "повинен містити хоча б %{count} символи"
+msgstr[2] "повинен містити хоча б %{count} символів"
+
+msgid "should have at least %{count} item(s)"
+msgid_plural "should have at least %{count} item(s)"
+msgstr[0] "повинен містити хоча б %{count} елемент"
+msgstr[1] "повинен містити хоча б %{count} елементи"
+msgstr[2] "повинен містити хоча б %{count} елементів"
+
+msgid "should be at most %{count} character(s)"
+msgid_plural "should be at most %{count} character(s)"
+msgstr[0] "повинен бути не більше %{count} символу"
+msgstr[1] "повинен бути не більше %{count} символів"
+msgstr[2] "повинен бути не більше %{count} символів"
+
+msgid "should have at most %{count} item(s)"
+msgid_plural "should have at most %{count} item(s)"
+msgstr[0] "повинен містити не більше %{count} елемента"
+msgstr[1] "повинен містити не більше %{count} елементів"
+msgstr[2] "повинен містити не більше %{count} елементів"
+
+## From Ecto.Changeset.validate_number/3
+msgid "must be less than %{number}"
+msgstr "повинен мати значення менше ніж %{number}"
+
+msgid "must be greater than %{number}"
+msgstr "повинен мати значення більше ніж %{number}"
+
+msgid "must be less than or equal to %{number}"
+msgstr "повинен мати значення менше або рівне %{number}"
+
+msgid "must be greater than or equal to %{number}"
+msgstr "повинен мати значення більше або рівне %{number}"
+
+msgid "must be equal to %{number}"
+msgstr "повинен мати лише значення, рівне %{number}"
+
+#: lib/pleroma/web/common_api/common_api.ex:505
+#, elixir-format
+msgid "Account not found"
+msgstr "Обліковий запис не знайдено"
+
+#: lib/pleroma/web/common_api/common_api.ex:339
+#, elixir-format
+msgid "Already voted"
+msgstr "Вже проголосовано"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:359
+#, elixir-format
+msgid "Bad request"
+msgstr "Невірний запит"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426
+#, elixir-format
+msgid "Can't delete object"
+msgstr "Виникла помилка при видаленні об'єкту"
+
+#: lib/pleroma/web/controller_helper.ex:105
+#: lib/pleroma/web/controller_helper.ex:111
+#, elixir-format
+msgid "Can't display this activity"
+msgstr "Не вдається відобразити цю активність"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285
+#, elixir-format
+msgid "Can't find user"
+msgstr "Користувача не знайдено"
+
+#: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61
+#, elixir-format
+msgid "Can't get favorites"
+msgstr "Не вдається отримати вподобання"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438
+#, elixir-format
+msgid "Can't like object"
+msgstr "Не вдається вподобати об’єкт"
+
+#: lib/pleroma/web/common_api/utils.ex:563
+#, elixir-format
+msgid "Cannot post an empty status without attachments"
+msgstr "Не вдається опублікувати порожнє повідомлення без вкладень"
+
+#: lib/pleroma/web/common_api/utils.ex:511
+#, elixir-format
+msgid "Comment must be up to %{max_size} characters"
+msgstr "Коментар може містити не більше %{max_size} символів"
+
+#: lib/pleroma/config/config_db.ex:191
+#, elixir-format
+msgid "Config with params %{params} not found"
+msgstr "Конфігурація з параметрами %{params} не знайдена"
+
+#: lib/pleroma/web/common_api/common_api.ex:181
+#: lib/pleroma/web/common_api/common_api.ex:185
+#, elixir-format
+msgid "Could not delete"
+msgstr "Не можу видалити"
+
+#: lib/pleroma/web/common_api/common_api.ex:231
+#, elixir-format
+msgid "Could not favorite"
+msgstr "Не вдалося додати до вподобаного"
+
+#: lib/pleroma/web/common_api/common_api.ex:453
+#, elixir-format
+msgid "Could not pin"
+msgstr "Не вдалося закріпити"
+
+#: lib/pleroma/web/common_api/common_api.ex:278
+#, elixir-format
+msgid "Could not unfavorite"
+msgstr "Не вдалося видалити з вподобаного"
+
+#: lib/pleroma/web/common_api/common_api.ex:463
+#, elixir-format
+msgid "Could not unpin"
+msgstr "Не вдалося відкріпити"
+
+#: lib/pleroma/web/common_api/common_api.ex:216
+#, elixir-format
+msgid "Could not unrepeat"
+msgstr "Не вдалося скасувати поширення"
+
+#: lib/pleroma/web/common_api/common_api.ex:512
+#: lib/pleroma/web/common_api/common_api.ex:521
+#, elixir-format
+msgid "Could not update state"
+msgstr "Не вдалося оновити стан"
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207
+#, elixir-format
+msgid "Error."
+msgstr "Помилка."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:106
+#, elixir-format
+msgid "Invalid CAPTCHA"
+msgstr "Невірна CAPTCHA"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116
+#: lib/pleroma/web/oauth/oauth_controller.ex:568
+#, elixir-format
+msgid "Invalid credentials"
+msgstr "Неправильні дані автентифікації"
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:38
+#, elixir-format
+msgid "Invalid credentials."
+msgstr "Неправильні дані автентифікації."
+
+#: lib/pleroma/web/common_api/common_api.ex:355
+#, elixir-format
+msgid "Invalid indices"
+msgstr "Неправильні індекси"
+
+#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid parameters"
+msgstr "Неправильні параметри"
+
+#: lib/pleroma/web/common_api/utils.ex:414
+#, elixir-format
+msgid "Invalid password."
+msgstr "Неправильний пароль."
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220
+#, elixir-format
+msgid "Invalid request"
+msgstr "Невірний запит"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:109
+#, elixir-format
+msgid "Kocaptcha service unavailable"
+msgstr "Сервіс Kocaptcha недоступний"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112
+#, elixir-format
+msgid "Missing parameters"
+msgstr "Відсутні параметри"
+
+#: lib/pleroma/web/common_api/utils.ex:547
+#, elixir-format
+msgid "No such conversation"
+msgstr "Немає такої розмови"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456
+#, elixir-format
+msgid "No such permission_group"
+msgstr "Не існує такої групи повноважень"
+
+#: lib/pleroma/plugs/uploaded_media.ex:84
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11
+#: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143
+#, elixir-format
+msgid "Not found"
+msgstr "Не знайдено"
+
+#: lib/pleroma/web/common_api/common_api.ex:331
+#, elixir-format
+msgid "Poll's author can't vote"
+msgstr "Автор опитування не може голосувати"
+
+#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:50 lib/pleroma/web/mastodon_api/controllers/status_controller.ex:306
+#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71
+#, elixir-format
+msgid "Record not found"
+msgstr "Запис не знайдено"
+
+#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35
+#: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36
+#: lib/pleroma/web/ostatus/ostatus_controller.ex:149
+#, elixir-format
+msgid "Something went wrong"
+msgstr "Щось зламалося"
+
+#: lib/pleroma/web/common_api/activity_draft.ex:107
+#, elixir-format
+msgid "The message visibility must be direct"
+msgstr "Видимість у повідомлення повинна бути `Приватний`"
+
+#: lib/pleroma/web/common_api/utils.ex:573
+#, elixir-format
+msgid "The status is over the character limit"
+msgstr "Цей статус перевищує ліміт символів"
+
+#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31
+#, elixir-format
+msgid "This resource requires authentication."
+msgstr "Цей ресурс вимагає автентифікації."
+
+#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
+#, elixir-format
+msgid "Throttled"
+msgstr "Обмежено. Перевищено ліміт запитів."
+
+#: lib/pleroma/web/common_api/common_api.ex:356
+#, elixir-format
+msgid "Too many choices"
+msgstr "Забагато варіантів вибору"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443
+#, elixir-format
+msgid "Unhandled activity type"
+msgstr "Непідтримуваний тип активності"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485
+#, elixir-format
+msgid "You can't revoke your own admin status."
+msgstr "Ви не можете позбавити самого себе статусу адміністратора."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:221
+#: lib/pleroma/web/oauth/oauth_controller.ex:308
+#, elixir-format
+msgid "Your account is currently disabled"
+msgstr "Ваш обліковий запис наразі вимкнено"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:183
+#: lib/pleroma/web/oauth/oauth_controller.ex:331
+#, elixir-format
+msgid "Your login is missing a confirmed e-mail address"
+msgstr "Ваша електрона адреса не підтверджена"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390
+#, elixir-format
+msgid "can't read inbox of %{nickname} as %{as_nickname}"
+msgstr ""
+"Не вдається прочитати \"Вхідні\" повідомлення %{nickname} як %{as_nickname}"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473
+#, elixir-format
+msgid "can't update outbox of %{nickname} as %{as_nickname}"
+msgstr ""
+"Не вдається оновити \"Вихідні\" повідомлення %{nickname} як %{as_nickname}"
+
+#: lib/pleroma/web/common_api/common_api.ex:471
+#, elixir-format
+msgid "conversation is already muted"
+msgstr "Розмова вже заглушена"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492
+#, elixir-format
+msgid "error"
+msgstr "помилка"
+
+#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32
+#, elixir-format
+msgid "mascots can only be images"
+msgstr "талісманами можуть бути лише зображення"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62
+#, elixir-format
+msgid "not found"
+msgstr "не знайдено"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:394
+#, elixir-format
+msgid "Bad OAuth request."
+msgstr "Невірний запит OAuth."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:115
+#, elixir-format
+msgid "CAPTCHA already used"
+msgstr "CAPTCHA вже використана"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:112
+#, elixir-format
+msgid "CAPTCHA expired"
+msgstr "Термін дії CAPTCHA закінчився"
+
+#: lib/pleroma/plugs/uploaded_media.ex:57
+#, elixir-format
+msgid "Failed"
+msgstr "Не вдалося"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:410
+#, elixir-format
+msgid "Failed to authenticate: %{message}."
+msgstr "Помилка автентифікації: %{message}."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:441
+#, elixir-format
+msgid "Failed to set up user account."
+msgstr "Не вдалося створити обліковий запис."
+
+#: lib/pleroma/plugs/oauth_scopes_plug.ex:38
+#, elixir-format
+msgid "Insufficient permissions: %{permissions}."
+msgstr "Недостатньо прав: %{permissions}."
+
+#: lib/pleroma/plugs/uploaded_media.ex:104
+#, elixir-format
+msgid "Internal Error"
+msgstr "Внутрішня помилка"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:22
+#: lib/pleroma/web/oauth/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid Username/Password"
+msgstr "Неправильне ім'я користувача або пароль"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:118
+#, elixir-format
+msgid "Invalid answer data"
+msgstr "Неправильна відповідь"
+
+#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33
+#, elixir-format
+msgid "Nodeinfo schema version not handled"
+msgstr "Версія схеми Nodeinfo не враховується"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:172
+#, elixir-format
+msgid "This action is outside the authorized scopes"
+msgstr "Ця дія виходить за рамки доступних повноважень"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:14
+#, elixir-format
+msgid "Unknown error, please check the details and try again."
+msgstr "Невідома помилка. Перевірте деталі та повторіть спробу."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:119
+#: lib/pleroma/web/oauth/oauth_controller.ex:158
+#, elixir-format
+msgid "Unlisted redirect_uri."
+msgstr "Невідомий redirect_uri."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:390
+#, elixir-format
+msgid "Unsupported OAuth provider: %{provider}."
+msgstr "Непідтримуваний постачальник послуг OAuth: %{provider}."
+
+#: lib/pleroma/uploaders/uploader.ex:72
+#, elixir-format
+msgid "Uploader callback timeout"
+msgstr "Тайм-аут при завантаженні"
+
+#: lib/pleroma/web/uploader_controller.ex:23
+#, elixir-format
+msgid "bad request"
+msgstr "невірний запит"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:103
+#, elixir-format
+msgid "CAPTCHA Error"
+msgstr "Помилка CAPTCHA"
+
+#: lib/pleroma/web/common_api/common_api.ex:290
+#, elixir-format
+msgid "Could not add reaction emoji"
+msgstr "Не вдалося додати емодзі для реакції"
+
+#: lib/pleroma/web/common_api/common_api.ex:301
+#, elixir-format
+msgid "Could not remove reaction emoji"
+msgstr "Не вдалося видалити реакцію"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:129
+#, elixir-format
+msgid "Invalid CAPTCHA (Missing parameter: %{name})"
+msgstr "Недійсна CAPTCHA (Відсутній параметр: %{name})"
+
+#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92
+#, elixir-format
+msgid "List not found"
+msgstr "Список не знайдено"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123
+#, elixir-format
+msgid "Missing parameter: %{name}"
+msgstr "Відсутній параметр: %{name}"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:210
+#: lib/pleroma/web/oauth/oauth_controller.ex:321
+#, elixir-format
+msgid "Password reset is required"
+msgstr "Потрібно скинути пароль"
+
+#: lib/pleroma/tests/auth_test_controller.ex:9
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/config_controller.ex:6 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/invite_controller.ex:6 lib/pleroma/web/admin_api/controllers/media_proxy_cache_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/oauth_app_controller.ex:6 lib/pleroma/web/admin_api/controllers/relay_controller.ex:6
+#: lib/pleroma/web/admin_api/controllers/report_controller.ex:6 lib/pleroma/web/admin_api/controllers/status_controller.ex:6
+#: lib/pleroma/web/controller_helper.ex:6 lib/pleroma/web/embed_controller.ex:6
+#: lib/pleroma/web/fallback_redirect_controller.ex:6 lib/pleroma/web/feed/tag_controller.ex:6
+#: lib/pleroma/web/feed/user_controller.ex:6 lib/pleroma/web/mailer/subscription_controller.ex:2
+#: lib/pleroma/web/masto_fe_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/account_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/app_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/auth_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/conversation_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/custom_emoji_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/domain_block_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/filter_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/follow_request_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/instance_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/list_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/marker_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:14
+#: lib/pleroma/web/mastodon_api/controllers/media_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/notification_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/report_controller.ex:8
+#: lib/pleroma/web/mastodon_api/controllers/scheduled_activity_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/search_controller.ex:6
+#: lib/pleroma/web/mastodon_api/controllers/status_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:7
+#: lib/pleroma/web/mastodon_api/controllers/suggestion_controller.ex:6 lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:6
+#: lib/pleroma/web/media_proxy/media_proxy_controller.ex:6 lib/pleroma/web/mongooseim/mongoose_im_controller.ex:6
+#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:6 lib/pleroma/web/oauth/fallback_controller.ex:6
+#: lib/pleroma/web/oauth/mfa_controller.ex:10 lib/pleroma/web/oauth/oauth_controller.ex:6
+#: lib/pleroma/web/ostatus/ostatus_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/account_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/chat_controller.ex:5 lib/pleroma/web/pleroma_api/controllers/conversation_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:2 lib/pleroma/web/pleroma_api/controllers/emoji_reaction_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:6 lib/pleroma/web/pleroma_api/controllers/notification_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/scrobble_controller.ex:6
+#: lib/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller.ex:7 lib/pleroma/web/static_fe/static_fe_controller.ex:6
+#: lib/pleroma/web/twitter_api/controllers/password_controller.ex:10 lib/pleroma/web/twitter_api/controllers/remote_follow_controller.ex:6
+#: lib/pleroma/web/twitter_api/controllers/util_controller.ex:6 lib/pleroma/web/twitter_api/twitter_api_controller.ex:6
+#: lib/pleroma/web/uploader_controller.ex:6 lib/pleroma/web/web_finger/web_finger_controller.ex:6
+#, elixir-format
+msgid "Security violation: OAuth scopes check was neither handled nor explicitly skipped."
+msgstr ""
+"Порушення безпеки: перевірка обсягу OAuth не була оброблена, ні явно "
+"пропущена."
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28
+#, elixir-format
+msgid "Two-factor authentication enabled, you must use a access token."
+msgstr ""
+"Двофакторна автентифікація ввімкнена, ви повинні використовувати ключ "
+"доступу."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210
+#, elixir-format
+msgid "Unexpected error occurred while adding file to pack."
+msgstr "Несподівана помилка при додаванні файлу в пакет."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138
+#, elixir-format
+msgid "Unexpected error occurred while creating pack."
+msgstr "Несподівана помилка під час створення пакета."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278
+#, elixir-format
+msgid "Unexpected error occurred while removing file from pack."
+msgstr "Під час видалення файлу з пакета сталася несподівана помилка."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250
+#, elixir-format
+msgid "Unexpected error occurred while updating file in pack."
+msgstr "Під час оновлення файлу в пакеті сталася несподівана помилка."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179
+#, elixir-format
+msgid "Unexpected error occurred while updating pack metadata."
+msgstr "Під час оновлення метаданих пакета сталася несподівана помилка."
+
+#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61
+#, elixir-format
+msgid "Web push subscription is disabled on this Pleroma instance"
+msgstr "Web push-сповіщення вимкнені на цьому інстансі Pleroma"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451
+#, elixir-format
+msgid "You can't revoke your own admin/moderator status."
+msgstr "Ви не можете позбавити самого себе статусу адміністратора/модератора."
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126
+#, elixir-format
+msgid "authorization required for timeline view"
+msgstr "необхідно ввійти в систему для перегляду стрічки повідомлень"
+
+#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24
+#, elixir-format
+msgid "Access denied"
+msgstr "Доступ заборонено"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282
+#, elixir-format
+msgid "This API requires an authenticated user"
+msgstr "Цей API вимагає автентифікованого користувача"
+
+#: lib/pleroma/plugs/user_is_admin_plug.ex:21
+#, elixir-format
+msgid "User is not an admin."
+msgstr "Користувач не є адміністратором."
diff --git a/priv/gettext/zh_Hans/LC_MESSAGES/errors.po b/priv/gettext/zh_Hans/LC_MESSAGES/errors.po
index 8b24d4a86..ecf1dab6b 100644
--- a/priv/gettext/zh_Hans/LC_MESSAGES/errors.po
+++ b/priv/gettext/zh_Hans/LC_MESSAGES/errors.po
@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-09-20 13:18+0000\n"
-"PO-Revision-Date: 2020-10-22 18:25+0000\n"
+"PO-Revision-Date: 2020-12-14 06:00+0000\n"
"Last-Translator: shironeko \n"
"Language-Team: Chinese (Simplified) \n"
@@ -146,9 +146,9 @@ msgid "Cannot post an empty status without attachments"
msgstr "无法发送空白且不包含附件的状态"
#: lib/pleroma/web/common_api/utils.ex:511
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Comment must be up to %{max_size} characters"
-msgstr ""
+msgstr "评论最多可使用 %{max_size} 字符"
#: lib/pleroma/config/config_db.ex:191
#, elixir-format
@@ -250,21 +250,21 @@ msgstr "没有该对话"
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:388
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:414 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:456
-#, elixir-format
+#, elixir-format, fuzzy
msgid "No such permission_group"
-msgstr ""
+msgstr "没有该权限组"
#: lib/pleroma/plugs/uploaded_media.ex:84
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:486 lib/pleroma/web/admin_api/controllers/fallback_controller.ex:11
#: lib/pleroma/web/feed/user_controller.ex:71 lib/pleroma/web/ostatus/ostatus_controller.ex:143
#, elixir-format
msgid "Not found"
-msgstr ""
+msgstr "未找到"
#: lib/pleroma/web/common_api/common_api.ex:331
#, elixir-format
msgid "Poll's author can't vote"
-msgstr ""
+msgstr "投票的发起者不能投票"
#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:20
#: lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:37 lib/pleroma/web/mastodon_api/controllers/poll_controller.ex:49
@@ -272,39 +272,39 @@ msgstr ""
#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:71
#, elixir-format
msgid "Record not found"
-msgstr ""
+msgstr "未找到该记录"
#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:35
#: lib/pleroma/web/feed/user_controller.ex:77 lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:36
#: lib/pleroma/web/ostatus/ostatus_controller.ex:149
#, elixir-format
msgid "Something went wrong"
-msgstr ""
+msgstr "发生了一些错误"
#: lib/pleroma/web/common_api/activity_draft.ex:107
#, elixir-format
msgid "The message visibility must be direct"
-msgstr ""
+msgstr "该消息必须为私信"
#: lib/pleroma/web/common_api/utils.ex:573
#, elixir-format
msgid "The status is over the character limit"
-msgstr ""
+msgstr "状态超过了字符数限制"
#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31
#, elixir-format
msgid "This resource requires authentication."
-msgstr ""
+msgstr "该资源需要认证。"
#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Throttled"
-msgstr ""
+msgstr "节流了"
#: lib/pleroma/web/common_api/common_api.ex:356
#, elixir-format
msgid "Too many choices"
-msgstr ""
+msgstr "太多选项"
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443
#, elixir-format
@@ -314,101 +314,101 @@ msgstr ""
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485
#, elixir-format
msgid "You can't revoke your own admin status."
-msgstr ""
+msgstr "您不能撤消自己的管理员权限。"
#: lib/pleroma/web/oauth/oauth_controller.ex:221
#: lib/pleroma/web/oauth/oauth_controller.ex:308
#, elixir-format
msgid "Your account is currently disabled"
-msgstr ""
+msgstr "您的账户已被禁用"
#: lib/pleroma/web/oauth/oauth_controller.ex:183
#: lib/pleroma/web/oauth/oauth_controller.ex:331
#, elixir-format
msgid "Your login is missing a confirmed e-mail address"
-msgstr ""
+msgstr "您的账户缺少已认证的 e-mail 地址"
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390
#, elixir-format
msgid "can't read inbox of %{nickname} as %{as_nickname}"
-msgstr ""
+msgstr "无法以 %{as_nickname} 读取 %{nickname} 的收件箱"
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:473
#, elixir-format
msgid "can't update outbox of %{nickname} as %{as_nickname}"
-msgstr ""
+msgstr "无法以 %{as_nickname} 更新 %{nickname} 的出件箱"
#: lib/pleroma/web/common_api/common_api.ex:471
#, elixir-format
msgid "conversation is already muted"
-msgstr ""
+msgstr "对话已经被静音"
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:314
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:492
#, elixir-format
msgid "error"
-msgstr ""
+msgstr "错误"
#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32
#, elixir-format
msgid "mascots can only be images"
-msgstr ""
+msgstr "吉祥物只能是图片"
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62
#, elixir-format
msgid "not found"
-msgstr ""
+msgstr "未找到"
#: lib/pleroma/web/oauth/oauth_controller.ex:394
#, elixir-format
msgid "Bad OAuth request."
-msgstr ""
+msgstr "错误的 OAuth 请求。"
#: lib/pleroma/web/twitter_api/twitter_api.ex:115
#, elixir-format
msgid "CAPTCHA already used"
-msgstr ""
+msgstr "验证码已被使用"
#: lib/pleroma/web/twitter_api/twitter_api.ex:112
#, elixir-format
msgid "CAPTCHA expired"
-msgstr ""
+msgstr "验证码已过期"
#: lib/pleroma/plugs/uploaded_media.ex:57
#, elixir-format
msgid "Failed"
-msgstr ""
+msgstr "失败"
#: lib/pleroma/web/oauth/oauth_controller.ex:410
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Failed to authenticate: %{message}."
-msgstr ""
+msgstr "认证失败:%{message}。"
#: lib/pleroma/web/oauth/oauth_controller.ex:441
#, elixir-format
msgid "Failed to set up user account."
-msgstr ""
+msgstr "建立用户帐号失败。"
#: lib/pleroma/plugs/oauth_scopes_plug.ex:38
#, elixir-format
msgid "Insufficient permissions: %{permissions}."
-msgstr ""
+msgstr "权限不足:%{permissions}。"
#: lib/pleroma/plugs/uploaded_media.ex:104
#, elixir-format
msgid "Internal Error"
-msgstr ""
+msgstr "内部错误"
#: lib/pleroma/web/oauth/fallback_controller.ex:22
#: lib/pleroma/web/oauth/fallback_controller.ex:29
#, elixir-format
msgid "Invalid Username/Password"
-msgstr ""
+msgstr "无效的用户名/密码"
#: lib/pleroma/web/twitter_api/twitter_api.ex:118
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Invalid answer data"
-msgstr ""
+msgstr "无效的回答数据"
#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33
#, elixir-format
@@ -418,12 +418,12 @@ msgstr ""
#: lib/pleroma/web/oauth/oauth_controller.ex:172
#, elixir-format
msgid "This action is outside the authorized scopes"
-msgstr ""
+msgstr "此操作在许可范围以外"
#: lib/pleroma/web/oauth/fallback_controller.ex:14
#, elixir-format
msgid "Unknown error, please check the details and try again."
-msgstr ""
+msgstr "未知错误,请检查并重试。"
#: lib/pleroma/web/oauth/oauth_controller.ex:119
#: lib/pleroma/web/oauth/oauth_controller.ex:158
@@ -434,53 +434,53 @@ msgstr ""
#: lib/pleroma/web/oauth/oauth_controller.ex:390
#, elixir-format
msgid "Unsupported OAuth provider: %{provider}."
-msgstr ""
+msgstr "不支持的 OAuth 提供者:%{provider}。"
#: lib/pleroma/uploaders/uploader.ex:72
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Uploader callback timeout"
-msgstr ""
+msgstr "上传回复超时"
#: lib/pleroma/web/uploader_controller.ex:23
#, elixir-format
msgid "bad request"
-msgstr ""
+msgstr "错误的请求"
#: lib/pleroma/web/twitter_api/twitter_api.ex:103
#, elixir-format
msgid "CAPTCHA Error"
-msgstr ""
+msgstr "验证码错误"
#: lib/pleroma/web/common_api/common_api.ex:290
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Could not add reaction emoji"
-msgstr ""
+msgstr "无法添加表情反应"
#: lib/pleroma/web/common_api/common_api.ex:301
#, elixir-format
msgid "Could not remove reaction emoji"
-msgstr ""
+msgstr "无法移除表情反应"
#: lib/pleroma/web/twitter_api/twitter_api.ex:129
#, elixir-format
msgid "Invalid CAPTCHA (Missing parameter: %{name})"
-msgstr ""
+msgstr "无效的验证码(缺少参数:%{name})"
#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92
#, elixir-format
msgid "List not found"
-msgstr ""
+msgstr "未找到列表"
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123
#, elixir-format
msgid "Missing parameter: %{name}"
-msgstr ""
+msgstr "缺少参数:%{name}"
#: lib/pleroma/web/oauth/oauth_controller.ex:210
#: lib/pleroma/web/oauth/oauth_controller.ex:321
#, elixir-format
msgid "Password reset is required"
-msgstr ""
+msgstr "需要重置密码"
#: lib/pleroma/tests/auth_test_controller.ex:9
#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:6 lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:6
@@ -520,61 +520,61 @@ msgid "Security violation: OAuth scopes check was neither handled nor explicitly
msgstr ""
#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Two-factor authentication enabled, you must use a access token."
-msgstr ""
+msgstr "已启用两因素验证,您需要使用访问令牌。"
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210
#, elixir-format
msgid "Unexpected error occurred while adding file to pack."
-msgstr ""
+msgstr "向表情包添加文件时发生了没有预料到的错误。"
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138
#, elixir-format
msgid "Unexpected error occurred while creating pack."
-msgstr ""
+msgstr "创建表情包时发生了没有预料到的错误。"
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278
#, elixir-format
msgid "Unexpected error occurred while removing file from pack."
-msgstr ""
+msgstr "从表情包移除文件时发生了没有预料到的错误。"
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250
#, elixir-format
msgid "Unexpected error occurred while updating file in pack."
-msgstr ""
+msgstr "更新表情包内的文件时发生了没有预料到的错误。"
#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179
#, elixir-format
msgid "Unexpected error occurred while updating pack metadata."
-msgstr ""
+msgstr "更新表情包元数据时发生了没有预料到的错误。"
#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61
-#, elixir-format
+#, elixir-format, fuzzy
msgid "Web push subscription is disabled on this Pleroma instance"
-msgstr ""
+msgstr "此 Pleroma 实例禁用了网页推送订阅"
#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:451
#, elixir-format
msgid "You can't revoke your own admin/moderator status."
-msgstr ""
+msgstr "您不能撤消自己的管理员权限。"
#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126
#, elixir-format
msgid "authorization required for timeline view"
-msgstr ""
+msgstr "浏览时间线需要认证"
#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24
#, elixir-format
msgid "Access denied"
-msgstr ""
+msgstr "拒绝访问"
#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282
#, elixir-format
msgid "This API requires an authenticated user"
-msgstr ""
+msgstr "此 API 需要已认证的用户"
#: lib/pleroma/plugs/user_is_admin_plug.ex:21
#, elixir-format
msgid "User is not an admin."
-msgstr ""
+msgstr "该用户不是管理员。"
diff --git a/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs b/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs
new file mode 100644
index 000000000..01fb90459
--- /dev/null
+++ b/priv/repo/migrations/20200831152600_add_pleroma_report_to_enum_for_notifications.exs
@@ -0,0 +1,48 @@
+defmodule Pleroma.Repo.Migrations.AddPleromaReportTypeToEnumForNotifications do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+
+ def up do
+ """
+ alter type notification_type add value 'pleroma:report'
+ """
+ |> execute()
+ end
+
+ def down do
+ alter table(:notifications) do
+ modify(:type, :string)
+ end
+
+ """
+ delete from notifications where type = 'pleroma:report'
+ """
+ |> execute()
+
+ """
+ drop type if exists notification_type
+ """
+ |> execute()
+
+ """
+ create type notification_type as enum (
+ 'follow',
+ 'follow_request',
+ 'mention',
+ 'move',
+ 'pleroma:emoji_reaction',
+ 'pleroma:chat_mention',
+ 'reblog',
+ 'favourite'
+ )
+ """
+ |> execute()
+
+ """
+ alter table notifications
+ alter column type type notification_type using (type::notification_type)
+ """
+ |> execute()
+ end
+end
diff --git a/priv/repo/migrations/20200915095704_remove_background_jobs.exs b/priv/repo/migrations/20200915095704_remove_background_jobs.exs
new file mode 100644
index 000000000..9785bfb8a
--- /dev/null
+++ b/priv/repo/migrations/20200915095704_remove_background_jobs.exs
@@ -0,0 +1,22 @@
+defmodule Pleroma.Repo.Migrations.RemoveBackgroundJobs do
+ use Ecto.Migration
+
+ import Ecto.Query, only: [from: 2]
+
+ def up do
+ from(j in "oban_jobs",
+ where:
+ j.queue == ^"background" and
+ fragment("?->>'op'", j.args) in ^[
+ "fetch_data_for_activity",
+ "media_proxy_prefetch",
+ "media_proxy_preload"
+ ] and
+ j.worker == ^"Pleroma.Workers.BackgroundWorker",
+ select: [:id]
+ )
+ |> Pleroma.Repo.delete_all()
+ end
+
+ def down, do: :ok
+end
diff --git a/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs b/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs
new file mode 100644
index 000000000..fe31f4442
--- /dev/null
+++ b/priv/repo/migrations/20201113060459_remove_purge_expired_activity_worker_from_oban_config.exs
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.RemovePurgeExpiredActivityWorkerFromObanConfig do
+ use Ecto.Migration
+
+ def change do
+ with %Pleroma.ConfigDB{} = config <-
+ Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Oban}),
+ crontab when is_list(crontab) <- config.value[:crontab],
+ index when is_integer(index) <-
+ Enum.find_index(crontab, fn {_, worker} ->
+ worker == Pleroma.Workers.Cron.PurgeExpiredActivitiesWorker
+ end) do
+ updated_value = Keyword.put(config.value, :crontab, List.delete_at(crontab, index))
+
+ config
+ |> Ecto.Changeset.change(value: updated_value)
+ |> Pleroma.Repo.update()
+ end
+ end
+end
diff --git a/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
new file mode 100644
index 000000000..560cc7447
--- /dev/null
+++ b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
@@ -0,0 +1,13 @@
+defmodule Pleroma.Repo.Migrations.DataMigrationProlongOAuthTokensValidUntil do
+ use Ecto.Migration
+
+ def up do
+ expires_in = Pleroma.Config.get!([:oauth2, :token_expires_in])
+ valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in, :second)
+ execute("update oauth_tokens set valid_until = '#{valid_until}'")
+ end
+
+ def down do
+ :noop
+ end
+end
diff --git a/priv/scrubbers/default.ex b/priv/scrubbers/default.ex
index ea0480dcd..7b06994de 100644
--- a/priv/scrubbers/default.ex
+++ b/priv/scrubbers/default.ex
@@ -47,6 +47,11 @@ defmodule Pleroma.HTML.Scrubber.Default do
Meta.allow_tag_with_these_attributes(:strong, [])
Meta.allow_tag_with_these_attributes(:sub, [])
Meta.allow_tag_with_these_attributes(:sup, [])
+ Meta.allow_tag_with_these_attributes(:ruby, [])
+ Meta.allow_tag_with_these_attributes(:rb, [])
+ Meta.allow_tag_with_these_attributes(:rp, [])
+ Meta.allow_tag_with_these_attributes(:rt, [])
+ Meta.allow_tag_with_these_attributes(:rtc, [])
Meta.allow_tag_with_these_attributes(:u, [])
Meta.allow_tag_with_these_attributes(:ul, [])
diff --git a/priv/static/adminfe/chunk-03c5.f59788cf.css b/priv/static/adminfe/chunk-03c5.e6a0e2d0.css
similarity index 100%
rename from priv/static/adminfe/chunk-03c5.f59788cf.css
rename to priv/static/adminfe/chunk-03c5.e6a0e2d0.css
diff --git a/priv/static/adminfe/chunk-9d55.e2cb1409.css b/priv/static/adminfe/chunk-0492.15b0611f.css
similarity index 100%
rename from priv/static/adminfe/chunk-9d55.e2cb1409.css
rename to priv/static/adminfe/chunk-0492.15b0611f.css
diff --git a/priv/static/adminfe/chunk-342d.e342722b.css b/priv/static/adminfe/chunk-04b0.7e25cd78.css
similarity index 97%
rename from priv/static/adminfe/chunk-342d.e342722b.css
rename to priv/static/adminfe/chunk-04b0.7e25cd78.css
index b0fd8dcb3..8dfdc0dcf 100644
Binary files a/priv/static/adminfe/chunk-342d.e342722b.css and b/priv/static/adminfe/chunk-04b0.7e25cd78.css differ
diff --git a/priv/static/adminfe/chunk-546f.692d1ab2.css b/priv/static/adminfe/chunk-0537.cd83e5d6.css
similarity index 100%
rename from priv/static/adminfe/chunk-546f.692d1ab2.css
rename to priv/static/adminfe/chunk-0537.cd83e5d6.css
diff --git a/priv/static/adminfe/chunk-170f.fea927c5.css b/priv/static/adminfe/chunk-170f.fea927c5.css
new file mode 100644
index 000000000..a4ab52d51
Binary files /dev/null and b/priv/static/adminfe/chunk-170f.fea927c5.css differ
diff --git a/priv/static/adminfe/chunk-176e.a3c8376d.css b/priv/static/adminfe/chunk-176e.d9a630b2.css
similarity index 100%
rename from priv/static/adminfe/chunk-176e.a3c8376d.css
rename to priv/static/adminfe/chunk-176e.d9a630b2.css
diff --git a/priv/static/adminfe/chunk-521f.b745ee5d.css b/priv/static/adminfe/chunk-1944.731ba892.css
similarity index 62%
rename from priv/static/adminfe/chunk-521f.b745ee5d.css
rename to priv/static/adminfe/chunk-1944.731ba892.css
index 7e8ffb651..6392d8e75 100644
Binary files a/priv/static/adminfe/chunk-521f.b745ee5d.css and b/priv/static/adminfe/chunk-1944.731ba892.css differ
diff --git a/priv/static/adminfe/chunk-654d.94689c39.css b/priv/static/adminfe/chunk-654d.94689c39.css
deleted file mode 100644
index 483d88545..000000000
Binary files a/priv/static/adminfe/chunk-654d.94689c39.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-68ea9.dac85813.css b/priv/static/adminfe/chunk-68ea9.8331e95e.css
similarity index 100%
rename from priv/static/adminfe/chunk-68ea9.dac85813.css
rename to priv/static/adminfe/chunk-68ea9.8331e95e.css
diff --git a/priv/static/adminfe/chunk-6e81.1c0f2da2.css b/priv/static/adminfe/chunk-6e81.559b76f9.css
similarity index 100%
rename from priv/static/adminfe/chunk-6e81.1c0f2da2.css
rename to priv/static/adminfe/chunk-6e81.559b76f9.css
diff --git a/priv/static/adminfe/chunk-7968.283bc086.css b/priv/static/adminfe/chunk-7968.283bc086.css
new file mode 100644
index 000000000..5d9863d3a
Binary files /dev/null and b/priv/static/adminfe/chunk-7968.283bc086.css differ
diff --git a/priv/static/adminfe/chunk-7c6b.365cbeda.css b/priv/static/adminfe/chunk-7c6b.b633878a.css
similarity index 100%
rename from priv/static/adminfe/chunk-7c6b.365cbeda.css
rename to priv/static/adminfe/chunk-7c6b.b633878a.css
diff --git a/priv/static/adminfe/chunk-850d.cc4f0ac6.css b/priv/static/adminfe/chunk-850d.cc4f0ac6.css
deleted file mode 100644
index 1cb2ead63..000000000
Binary files a/priv/static/adminfe/chunk-850d.cc4f0ac6.css and /dev/null differ
diff --git a/priv/static/adminfe/chunk-8fbb.dd321643.css b/priv/static/adminfe/chunk-8fbb.dd321643.css
new file mode 100644
index 000000000..f50d974bd
Binary files /dev/null and b/priv/static/adminfe/chunk-8fbb.dd321643.css differ
diff --git a/priv/static/adminfe/chunk-3365.201aa8e6.css b/priv/static/adminfe/chunk-ad1e.1a3c5339.css
similarity index 100%
rename from priv/static/adminfe/chunk-3365.201aa8e6.css
rename to priv/static/adminfe/chunk-ad1e.1a3c5339.css
diff --git a/priv/static/adminfe/chunk-commons.c0eb3eb7.css b/priv/static/adminfe/chunk-commons.f7c3d390.css
similarity index 100%
rename from priv/static/adminfe/chunk-commons.c0eb3eb7.css
rename to priv/static/adminfe/chunk-commons.f7c3d390.css
diff --git a/priv/static/adminfe/chunk-d34d.b0dd6fb4.css b/priv/static/adminfe/chunk-e660.9e75af5b.css
similarity index 100%
rename from priv/static/adminfe/chunk-d34d.b0dd6fb4.css
rename to priv/static/adminfe/chunk-e660.9e75af5b.css
diff --git a/priv/static/adminfe/chunk-f364.6b5f3f0d.css b/priv/static/adminfe/chunk-f364.6b5f3f0d.css
new file mode 100644
index 000000000..ec665da84
Binary files /dev/null and b/priv/static/adminfe/chunk-f364.6b5f3f0d.css differ
diff --git a/priv/static/adminfe/chunk-f625.25a6a4ae.css b/priv/static/adminfe/chunk-f625.bcd0ea3b.css
similarity index 100%
rename from priv/static/adminfe/chunk-f625.25a6a4ae.css
rename to priv/static/adminfe/chunk-f625.bcd0ea3b.css
diff --git a/priv/static/adminfe/index.html b/priv/static/adminfe/index.html
index d6b9b22b8..e6af40e97 100644
--- a/priv/static/adminfe/index.html
+++ b/priv/static/adminfe/index.html
@@ -1 +1 @@
-Admin FE
\ No newline at end of file
+Admin FE
\ No newline at end of file
diff --git a/priv/static/adminfe/static/js/app.69891fda.js b/priv/static/adminfe/static/js/app.69891fda.js
deleted file mode 100644
index 3d04d9273..000000000
Binary files a/priv/static/adminfe/static/js/app.69891fda.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/app.69891fda.js.map b/priv/static/adminfe/static/js/app.69891fda.js.map
deleted file mode 100644
index 0131793e9..000000000
Binary files a/priv/static/adminfe/static/js/app.69891fda.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/app.c67f9a2f.js b/priv/static/adminfe/static/js/app.c67f9a2f.js
new file mode 100644
index 000000000..65f9d4a29
Binary files /dev/null and b/priv/static/adminfe/static/js/app.c67f9a2f.js differ
diff --git a/priv/static/adminfe/static/js/app.c67f9a2f.js.map b/priv/static/adminfe/static/js/app.c67f9a2f.js.map
new file mode 100644
index 000000000..41b4375aa
Binary files /dev/null and b/priv/static/adminfe/static/js/app.c67f9a2f.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-03c5.1c694c49.js
rename to priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js
index b4601abae..a89c65572 100644
Binary files a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js and b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js differ
diff --git a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map
rename to priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map
index 193c65bb1..963ff6dee 100644
Binary files a/priv/static/adminfe/static/js/chunk-03c5.1c694c49.js.map and b/priv/static/adminfe/static/js/chunk-03c5.6de0c4c7.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js
new file mode 100644
index 000000000..243ecde70
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js differ
diff --git a/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map
new file mode 100644
index 000000000..f5e0d9ebc
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-0492.47abe1dc.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js
new file mode 100644
index 000000000..9d0352814
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js differ
diff --git a/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map
new file mode 100644
index 000000000..a9bee3721
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-04b0.90c6d24c.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-546f.81668ba7.js
rename to priv/static/adminfe/static/js/chunk-0537.74db16b0.js
index 252991021..35231e562 100644
Binary files a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js and b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js differ
diff --git a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map
rename to priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map
index 6a9d2a8dc..fa87bd76d 100644
Binary files a/priv/static/adminfe/static/js/chunk-546f.81668ba7.js.map and b/priv/static/adminfe/static/js/chunk-0537.74db16b0.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js b/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js
new file mode 100644
index 000000000..d40dc29bd
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js differ
diff --git a/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js.map b/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js.map
new file mode 100644
index 000000000..91d3bc70d
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-170f.e1d6aac3.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-176e.be050aba.js b/priv/static/adminfe/static/js/chunk-176e.f64cb745.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-176e.be050aba.js
rename to priv/static/adminfe/static/js/chunk-176e.f64cb745.js
index cab83489b..dd60693da 100644
Binary files a/priv/static/adminfe/static/js/chunk-176e.be050aba.js and b/priv/static/adminfe/static/js/chunk-176e.f64cb745.js differ
diff --git a/priv/static/adminfe/static/js/chunk-176e.be050aba.js.map b/priv/static/adminfe/static/js/chunk-176e.f64cb745.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-176e.be050aba.js.map
rename to priv/static/adminfe/static/js/chunk-176e.f64cb745.js.map
index bff959cd6..9ee6aa6e4 100644
Binary files a/priv/static/adminfe/static/js/chunk-176e.be050aba.js.map and b/priv/static/adminfe/static/js/chunk-176e.f64cb745.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js
new file mode 100644
index 000000000..87590c6ce
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js differ
diff --git a/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map
new file mode 100644
index 000000000..23229293e
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-1944.7bed0c4b.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js
deleted file mode 100644
index 5ee311c4a..000000000
Binary files a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map b/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map
deleted file mode 100644
index b73bbb0aa..000000000
Binary files a/priv/static/adminfe/static/js/chunk-342d.479e01dd.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-521f.748b331d.js b/priv/static/adminfe/static/js/chunk-521f.748b331d.js
deleted file mode 100644
index 570dab224..000000000
Binary files a/priv/static/adminfe/static/js/chunk-521f.748b331d.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map b/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map
deleted file mode 100644
index 3380bbbd5..000000000
Binary files a/priv/static/adminfe/static/js/chunk-521f.748b331d.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-654d.653b067f.js b/priv/static/adminfe/static/js/chunk-654d.653b067f.js
deleted file mode 100644
index 209873ec1..000000000
Binary files a/priv/static/adminfe/static/js/chunk-654d.653b067f.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map b/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map
deleted file mode 100644
index 72aca0e98..000000000
Binary files a/priv/static/adminfe/static/js/chunk-654d.653b067f.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js
rename to priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js
index 02091ed84..60056454d 100644
Binary files a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js and b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js differ
diff --git a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map
rename to priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map
index 019cede66..9e26519c3 100644
Binary files a/priv/static/adminfe/static/js/chunk-68ea9.9821cd6a.js.map and b/priv/static/adminfe/static/js/chunk-68ea9.2b2877d5.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js b/priv/static/adminfe/static/js/chunk-6e81.afade883.js
similarity index 97%
rename from priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js
rename to priv/static/adminfe/static/js/chunk-6e81.afade883.js
index cd79db1d3..3b5dd6c5c 100644
Binary files a/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js and b/priv/static/adminfe/static/js/chunk-6e81.afade883.js differ
diff --git a/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map b/priv/static/adminfe/static/js/chunk-6e81.afade883.js.map
similarity index 98%
rename from priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map
rename to priv/static/adminfe/static/js/chunk-6e81.afade883.js.map
index 10b437760..a0f7fca19 100644
Binary files a/priv/static/adminfe/static/js/chunk-6e81.ebe9039f.js.map and b/priv/static/adminfe/static/js/chunk-6e81.afade883.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js
new file mode 100644
index 000000000..dc981706f
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js differ
diff --git a/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map
new file mode 100644
index 000000000..c2f0726b7
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-7968.f51e3292.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js b/priv/static/adminfe/static/js/chunk-7c6b.34152862.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-7c6b.56a14571.js
rename to priv/static/adminfe/static/js/chunk-7c6b.34152862.js
index df9b7d6ac..27d57d3ff 100644
Binary files a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js and b/priv/static/adminfe/static/js/chunk-7c6b.34152862.js differ
diff --git a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map b/priv/static/adminfe/static/js/chunk-7c6b.34152862.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map
rename to priv/static/adminfe/static/js/chunk-7c6b.34152862.js.map
index 6584ba082..78026f5f4 100644
Binary files a/priv/static/adminfe/static/js/chunk-7c6b.56a14571.js.map and b/priv/static/adminfe/static/js/chunk-7c6b.34152862.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js
deleted file mode 100644
index a2c2df2e7..000000000
Binary files a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map b/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map
deleted file mode 100644
index 7f7718547..000000000
Binary files a/priv/static/adminfe/static/js/chunk-850d.3e6102c2.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js
new file mode 100644
index 000000000..74ffe9194
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js differ
diff --git a/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map
new file mode 100644
index 000000000..b3c3b5fe8
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-8fbb.c847ce9d.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js
deleted file mode 100644
index 89d35af79..000000000
Binary files a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map b/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map
deleted file mode 100644
index fa8694b8e..000000000
Binary files a/priv/static/adminfe/static/js/chunk-9d55.7af22f45.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-3365.b73c30a8.js
rename to priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js
index 421bf2a99..82ddd4df2 100644
Binary files a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js and b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js differ
diff --git a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map
rename to priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map
index d2ad4d9aa..d74c2498f 100644
Binary files a/priv/static/adminfe/static/js/chunk-3365.b73c30a8.js.map and b/priv/static/adminfe/static/js/chunk-ad1e.eba9db26.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-commons.a6002038.js b/priv/static/adminfe/static/js/chunk-commons.4ae74caa.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-commons.a6002038.js
rename to priv/static/adminfe/static/js/chunk-commons.4ae74caa.js
index 2b16da9c7..1ee2ea9e4 100644
Binary files a/priv/static/adminfe/static/js/chunk-commons.a6002038.js and b/priv/static/adminfe/static/js/chunk-commons.4ae74caa.js differ
diff --git a/priv/static/adminfe/static/js/chunk-commons.a6002038.js.map b/priv/static/adminfe/static/js/chunk-commons.4ae74caa.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-commons.a6002038.js.map
rename to priv/static/adminfe/static/js/chunk-commons.4ae74caa.js.map
index 3c7d78861..41a884d15 100644
Binary files a/priv/static/adminfe/static/js/chunk-commons.a6002038.js.map and b/priv/static/adminfe/static/js/chunk-commons.4ae74caa.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js
similarity index 97%
rename from priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js
rename to priv/static/adminfe/static/js/chunk-e660.feca27c4.js
index edd221e6e..5659d263e 100644
Binary files a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js and b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js differ
diff --git a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map
rename to priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map
index 6bcd4ed8b..cfc2e08af 100644
Binary files a/priv/static/adminfe/static/js/chunk-d34d.0f06fe76.js.map and b/priv/static/adminfe/static/js/chunk-e660.feca27c4.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-f364.1122502b.js b/priv/static/adminfe/static/js/chunk-f364.1122502b.js
new file mode 100644
index 000000000..facad2ed5
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.1122502b.js differ
diff --git a/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map b/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map
new file mode 100644
index 000000000..f89dabe30
Binary files /dev/null and b/priv/static/adminfe/static/js/chunk-f364.1122502b.js.map differ
diff --git a/priv/static/adminfe/static/js/chunk-f625.29237434.js b/priv/static/adminfe/static/js/chunk-f625.904137fd.js
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-f625.29237434.js
rename to priv/static/adminfe/static/js/chunk-f625.904137fd.js
index 522755a98..053590b28 100644
Binary files a/priv/static/adminfe/static/js/chunk-f625.29237434.js and b/priv/static/adminfe/static/js/chunk-f625.904137fd.js differ
diff --git a/priv/static/adminfe/static/js/chunk-f625.29237434.js.map b/priv/static/adminfe/static/js/chunk-f625.904137fd.js.map
similarity index 99%
rename from priv/static/adminfe/static/js/chunk-f625.29237434.js.map
rename to priv/static/adminfe/static/js/chunk-f625.904137fd.js.map
index 4f8774c3a..59c1c274e 100644
Binary files a/priv/static/adminfe/static/js/chunk-f625.29237434.js.map and b/priv/static/adminfe/static/js/chunk-f625.904137fd.js.map differ
diff --git a/priv/static/adminfe/static/js/runtime.8f631d12.js b/priv/static/adminfe/static/js/runtime.8f631d12.js
deleted file mode 100644
index 6fa7d9ee1..000000000
Binary files a/priv/static/adminfe/static/js/runtime.8f631d12.js and /dev/null differ
diff --git a/priv/static/adminfe/static/js/runtime.8f631d12.js.map b/priv/static/adminfe/static/js/runtime.8f631d12.js.map
deleted file mode 100644
index d5c20400e..000000000
Binary files a/priv/static/adminfe/static/js/runtime.8f631d12.js.map and /dev/null differ
diff --git a/priv/static/adminfe/static/js/runtime.ba96836e.js b/priv/static/adminfe/static/js/runtime.ba96836e.js
new file mode 100644
index 000000000..245c7fe20
Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.ba96836e.js differ
diff --git a/priv/static/adminfe/static/js/runtime.ba96836e.js.map b/priv/static/adminfe/static/js/runtime.ba96836e.js.map
new file mode 100644
index 000000000..f3c5a82af
Binary files /dev/null and b/priv/static/adminfe/static/js/runtime.ba96836e.js.map differ
diff --git a/priv/static/emoji/dino walking.gif b/priv/static/emoji/dino walking.gif
new file mode 100644
index 000000000..694a541e7
Binary files /dev/null and b/priv/static/emoji/dino walking.gif differ
diff --git a/priv/static/static/logo.png b/priv/static/images/logo.png
similarity index 100%
rename from priv/static/static/logo.png
rename to priv/static/images/logo.png
diff --git a/priv/static/index.html b/priv/static/index.html
index f5690a8d6..9b774959a 100644
--- a/priv/static/index.html
+++ b/priv/static/index.html
@@ -1 +1 @@
-Pleroma To use Pleroma, please enable JavaScript.
\ No newline at end of file
+Pleroma To use Pleroma, please enable JavaScript.
\ No newline at end of file
diff --git a/priv/static/instance/static.css b/priv/static/instance/static.css
new file mode 100644
index 000000000..487e1ec27
Binary files /dev/null and b/priv/static/instance/static.css differ
diff --git a/priv/static/static/config.json b/priv/static/static/config.json
index 0030f78f1..f59e645ac 100644
--- a/priv/static/static/config.json
+++ b/priv/static/static/config.json
@@ -10,9 +10,10 @@
"hideSitename": false,
"hideUserStats": false,
"loginMethod": "password",
- "logo": "/static/logo.png",
+ "logo": "/static/logo.svg",
"logoMargin": ".1em",
"logoMask": true,
+ "logoLeft": false,
"minimalScopesMode": false,
"nsfwCensorImage": "",
"postContentType": "text/plain",
diff --git a/priv/static/static/css/app.77b1644622e3bae24b6b.css.map b/priv/static/static/css/app.77b1644622e3bae24b6b.css.map
deleted file mode 100644
index 4b042ef35..000000000
--- a/priv/static/static/css/app.77b1644622e3bae24b6b.css.map
+++ /dev/null
@@ -1 +0,0 @@
-{"version":3,"sources":["webpack:///./src/components/tab_switcher/tab_switcher.scss","webpack:///./src/hocs/with_load_more/with_load_more.scss"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;ACtOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C","file":"static/css/app.77b1644622e3bae24b6b.css","sourcesContent":[".tab-switcher {\n display: -ms-flexbox;\n display: flex;\n}\n.tab-switcher .tab-icon {\n font-size: 2em;\n display: block;\n}\n.tab-switcher.top-tabs {\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher.top-tabs > .tabs {\n width: 100%;\n overflow-y: hidden;\n overflow-x: auto;\n padding-top: 5px;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.tab-switcher.top-tabs > .tabs::after, .tab-switcher.top-tabs > .tabs::before {\n content: \"\";\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n border-bottom: 1px solid;\n border-bottom-color: #222;\n border-bottom-color: var(--border, #222);\n}\n.tab-switcher.top-tabs > .tabs .tab-wrapper {\n height: 28px;\n}\n.tab-switcher.top-tabs > .tabs .tab-wrapper:not(.active)::after {\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid;\n border-bottom-color: #222;\n border-bottom-color: var(--border, #222);\n}\n.tab-switcher.top-tabs > .tabs .tab {\n width: 100%;\n min-width: 1px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n padding-bottom: 99px;\n margin-bottom: -93px;\n}\n.tab-switcher.top-tabs .contents.scrollable-tabs {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n}\n.tab-switcher.side-tabs {\n -ms-flex-direction: row;\n flex-direction: row;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs {\n overflow-x: auto;\n }\n}\n.tab-switcher.side-tabs > .contents {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.tab-switcher.side-tabs > .tabs {\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n overflow-y: auto;\n overflow-x: hidden;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher.side-tabs > .tabs::after, .tab-switcher.side-tabs > .tabs::before {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n -ms-flex-preferred-size: 0.5em;\n flex-basis: 0.5em;\n content: \"\";\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs::after {\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n.tab-switcher.side-tabs > .tabs::before {\n -ms-flex-positive: 0;\n flex-grow: 0;\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper {\n min-width: 10em;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs > .tabs .tab-wrapper {\n min-width: 1em;\n }\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper:not(.active)::after {\n top: 0;\n right: 0;\n bottom: 0;\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper::before {\n -ms-flex: 0 0 6px;\n flex: 0 0 6px;\n content: \"\";\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper:last-child .tab {\n margin-bottom: 0;\n}\n.tab-switcher.side-tabs > .tabs .tab {\n -ms-flex: 1;\n flex: 1;\n box-sizing: content-box;\n min-width: 10em;\n min-width: 1px;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n padding-left: 1em;\n padding-right: calc(1em + 200px);\n margin-right: -200px;\n margin-left: 1em;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs > .tabs .tab {\n padding-left: 0.25em;\n padding-right: calc(.25em + 200px);\n margin-right: calc(.25em - 200px);\n margin-left: 0.25em;\n }\n .tab-switcher.side-tabs > .tabs .tab .text {\n display: none;\n }\n}\n.tab-switcher .contents {\n -ms-flex: 1 0 auto;\n flex: 1 0 auto;\n min-height: 0px;\n}\n.tab-switcher .contents .hidden {\n display: none;\n}\n.tab-switcher .contents .full-height:not(.hidden) {\n height: 100%;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher .contents .full-height:not(.hidden) > *:not(.mobile-label) {\n -ms-flex: 1;\n flex: 1;\n}\n.tab-switcher .contents.scrollable-tabs {\n overflow-y: auto;\n}\n.tab-switcher .tab {\n position: relative;\n white-space: nowrap;\n padding: 6px 1em;\n background-color: #182230;\n background-color: var(--tab, #182230);\n}\n.tab-switcher .tab, .tab-switcher .tab:active .tab-icon {\n color: #b9b9ba;\n color: var(--tabText, #b9b9ba);\n}\n.tab-switcher .tab:not(.active) {\n z-index: 4;\n}\n.tab-switcher .tab:not(.active):hover {\n z-index: 6;\n}\n.tab-switcher .tab.active {\n background: transparent;\n z-index: 5;\n color: #b9b9ba;\n color: var(--tabActiveText, #b9b9ba);\n}\n.tab-switcher .tab img {\n max-height: 26px;\n vertical-align: top;\n margin-top: -5px;\n}\n.tab-switcher .tabs {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n box-sizing: border-box;\n}\n.tab-switcher .tabs::after, .tab-switcher .tabs::before {\n display: block;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.tab-switcher .tab-wrapper {\n position: relative;\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.tab-switcher .tab-wrapper:not(.active)::after {\n content: \"\";\n position: absolute;\n z-index: 7;\n}\n.tab-switcher .mobile-label {\n padding-left: 0.3em;\n padding-bottom: 0.25em;\n margin-top: 0.5em;\n margin-left: 0.2em;\n margin-bottom: 0.25em;\n border-bottom: 1px solid var(--border, #222);\n}\n@media all and (min-width: 800px) {\n .tab-switcher .mobile-label {\n display: none;\n }\n}",".with-load-more-footer {\n padding: 10px;\n text-align: center;\n border-top: 1px solid;\n border-top-color: #222;\n border-top-color: var(--border, #222);\n}\n.with-load-more-footer .error {\n font-size: 14px;\n}\n.with-load-more-footer a {\n cursor: pointer;\n}"],"sourceRoot":""}
\ No newline at end of file
diff --git a/priv/static/static/css/app.77b1644622e3bae24b6b.css b/priv/static/static/css/app.9a4c5ede37b2f0230836.css
similarity index 98%
rename from priv/static/static/css/app.77b1644622e3bae24b6b.css
rename to priv/static/static/css/app.9a4c5ede37b2f0230836.css
index 8038882c0..22b9fdbe7 100644
Binary files a/priv/static/static/css/app.77b1644622e3bae24b6b.css and b/priv/static/static/css/app.9a4c5ede37b2f0230836.css differ
diff --git a/priv/static/static/css/app.9a4c5ede37b2f0230836.css.map b/priv/static/static/css/app.9a4c5ede37b2f0230836.css.map
new file mode 100644
index 000000000..f54bd9ee6
--- /dev/null
+++ b/priv/static/static/css/app.9a4c5ede37b2f0230836.css.map
@@ -0,0 +1 @@
+{"version":3,"sources":["webpack:///./src/components/tab_switcher/tab_switcher.scss","webpack:///./src/hocs/with_load_more/with_load_more.scss"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C;ACtOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,C","file":"static/css/app.9a4c5ede37b2f0230836.css","sourcesContent":[".tab-switcher {\n display: -ms-flexbox;\n display: flex;\n}\n.tab-switcher .tab-icon {\n margin: 0.2em auto;\n display: block;\n}\n.tab-switcher.top-tabs {\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher.top-tabs > .tabs {\n width: 100%;\n overflow-y: hidden;\n overflow-x: auto;\n padding-top: 5px;\n -ms-flex-direction: row;\n flex-direction: row;\n}\n.tab-switcher.top-tabs > .tabs::after, .tab-switcher.top-tabs > .tabs::before {\n content: \"\";\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n border-bottom: 1px solid;\n border-bottom-color: #222;\n border-bottom-color: var(--border, #222);\n}\n.tab-switcher.top-tabs > .tabs .tab-wrapper {\n height: 28px;\n}\n.tab-switcher.top-tabs > .tabs .tab-wrapper:not(.active)::after {\n left: 0;\n right: 0;\n bottom: 0;\n border-bottom: 1px solid;\n border-bottom-color: #222;\n border-bottom-color: var(--border, #222);\n}\n.tab-switcher.top-tabs > .tabs .tab {\n width: 100%;\n min-width: 1px;\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n padding-bottom: 99px;\n margin-bottom: -93px;\n}\n.tab-switcher.top-tabs .contents.scrollable-tabs {\n -ms-flex-preferred-size: 0;\n flex-basis: 0;\n}\n.tab-switcher.side-tabs {\n -ms-flex-direction: row;\n flex-direction: row;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs {\n overflow-x: auto;\n }\n}\n.tab-switcher.side-tabs > .contents {\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.tab-switcher.side-tabs > .tabs {\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n overflow-y: auto;\n overflow-x: hidden;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher.side-tabs > .tabs::after, .tab-switcher.side-tabs > .tabs::before {\n -ms-flex-negative: 0;\n flex-shrink: 0;\n -ms-flex-preferred-size: 0.5em;\n flex-basis: 0.5em;\n content: \"\";\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs::after {\n -ms-flex-positive: 1;\n flex-grow: 1;\n}\n.tab-switcher.side-tabs > .tabs::before {\n -ms-flex-positive: 0;\n flex-grow: 0;\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper {\n min-width: 10em;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs > .tabs .tab-wrapper {\n min-width: 4em;\n }\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper:not(.active)::after {\n top: 0;\n right: 0;\n bottom: 0;\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper::before {\n -ms-flex: 0 0 6px;\n flex: 0 0 6px;\n content: \"\";\n border-right: 1px solid;\n border-right-color: #222;\n border-right-color: var(--border, #222);\n}\n.tab-switcher.side-tabs > .tabs .tab-wrapper:last-child .tab {\n margin-bottom: 0;\n}\n.tab-switcher.side-tabs > .tabs .tab {\n -ms-flex: 1;\n flex: 1;\n box-sizing: content-box;\n min-width: 10em;\n min-width: 1px;\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n padding-left: 1em;\n padding-right: calc(1em + 200px);\n margin-right: -200px;\n margin-left: 1em;\n}\n@media all and (max-width: 800px) {\n .tab-switcher.side-tabs > .tabs .tab {\n padding-left: 0.25em;\n padding-right: calc(.25em + 200px);\n margin-right: calc(.25em - 200px);\n margin-left: 0.25em;\n }\n .tab-switcher.side-tabs > .tabs .tab .text {\n display: none;\n }\n}\n.tab-switcher .contents {\n -ms-flex: 1 0 auto;\n flex: 1 0 auto;\n min-height: 0px;\n}\n.tab-switcher .contents .hidden {\n display: none;\n}\n.tab-switcher .contents .full-height:not(.hidden) {\n height: 100%;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n}\n.tab-switcher .contents .full-height:not(.hidden) > *:not(.mobile-label) {\n -ms-flex: 1;\n flex: 1;\n}\n.tab-switcher .contents.scrollable-tabs {\n overflow-y: auto;\n}\n.tab-switcher .tab {\n position: relative;\n white-space: nowrap;\n padding: 6px 1em;\n background-color: #182230;\n background-color: var(--tab, #182230);\n}\n.tab-switcher .tab, .tab-switcher .tab:active .tab-icon {\n color: #b9b9ba;\n color: var(--tabText, #b9b9ba);\n}\n.tab-switcher .tab:not(.active) {\n z-index: 4;\n}\n.tab-switcher .tab:not(.active):hover {\n z-index: 6;\n}\n.tab-switcher .tab.active {\n background: transparent;\n z-index: 5;\n color: #b9b9ba;\n color: var(--tabActiveText, #b9b9ba);\n}\n.tab-switcher .tab img {\n max-height: 26px;\n vertical-align: top;\n margin-top: -5px;\n}\n.tab-switcher .tabs {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n box-sizing: border-box;\n}\n.tab-switcher .tabs::after, .tab-switcher .tabs::before {\n display: block;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n.tab-switcher .tab-wrapper {\n position: relative;\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n.tab-switcher .tab-wrapper:not(.active)::after {\n content: \"\";\n position: absolute;\n z-index: 7;\n}\n.tab-switcher .mobile-label {\n padding-left: 0.3em;\n padding-bottom: 0.25em;\n margin-top: 0.5em;\n margin-left: 0.2em;\n margin-bottom: 0.25em;\n border-bottom: 1px solid var(--border, #222);\n}\n@media all and (min-width: 800px) {\n .tab-switcher .mobile-label {\n display: none;\n }\n}",".with-load-more-footer {\n padding: 10px;\n text-align: center;\n border-top: 1px solid;\n border-top-color: #222;\n border-top-color: var(--border, #222);\n}\n.with-load-more-footer .error {\n font-size: 14px;\n}\n.with-load-more-footer a {\n cursor: pointer;\n}"],"sourceRoot":""}
\ No newline at end of file
diff --git a/priv/static/static/font/fontello.1600365488745.eot b/priv/static/static/font/fontello.1600365488745.eot
deleted file mode 100644
index 255f50372..000000000
Binary files a/priv/static/static/font/fontello.1600365488745.eot and /dev/null differ
diff --git a/priv/static/static/font/fontello.1600365488745.svg b/priv/static/static/font/fontello.1600365488745.svg
deleted file mode 100644
index 9eddf62ea..000000000
--- a/priv/static/static/font/fontello.1600365488745.svg
+++ /dev/null
@@ -1,140 +0,0 @@
-
-
-
-Copyright (C) 2020 by original authors @ fontello.com
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/priv/static/static/font/fontello.1600365488745.ttf b/priv/static/static/font/fontello.1600365488745.ttf
deleted file mode 100644
index 6bda99d50..000000000
Binary files a/priv/static/static/font/fontello.1600365488745.ttf and /dev/null differ
diff --git a/priv/static/static/font/fontello.1600365488745.woff b/priv/static/static/font/fontello.1600365488745.woff
deleted file mode 100644
index 11c866ae0..000000000
Binary files a/priv/static/static/font/fontello.1600365488745.woff and /dev/null differ
diff --git a/priv/static/static/font/fontello.1600365488745.woff2 b/priv/static/static/font/fontello.1600365488745.woff2
deleted file mode 100644
index 06151d28c..000000000
Binary files a/priv/static/static/font/fontello.1600365488745.woff2 and /dev/null differ
diff --git a/priv/static/static/fontello.1600365488745.css b/priv/static/static/fontello.1600365488745.css
deleted file mode 100644
index 781ff7620..000000000
Binary files a/priv/static/static/fontello.1600365488745.css and /dev/null differ
diff --git a/priv/static/static/fontello.json b/priv/static/static/fontello.json
deleted file mode 100644
index b0136fd90..000000000
--- a/priv/static/static/fontello.json
+++ /dev/null
@@ -1,416 +0,0 @@
-{
- "name": "",
- "css_prefix_text": "icon-",
- "css_use_suffix": false,
- "hinting": true,
- "units_per_em": 1000,
- "ascent": 857,
- "glyphs": [
- {
- "uid": "9bd60140934a1eb9236fd7a8ab1ff6ba",
- "css": "spin4",
- "code": 59444,
- "src": "fontelico"
- },
- {
- "uid": "5211af474d3a9848f67f945e2ccaf143",
- "css": "cancel",
- "code": 59392,
- "src": "fontawesome"
- },
- {
- "uid": "eeec3208c90b7b48e804919d0d2d4a41",
- "css": "upload",
- "code": 59393,
- "src": "fontawesome"
- },
- {
- "uid": "2a6740fc2f9d0edea54205963f662594",
- "css": "spin3",
- "code": 59442,
- "src": "fontelico"
- },
- {
- "uid": "c6be5a58ee4e63a5ec399c2b0d15cf2c",
- "css": "reply",
- "code": 61714,
- "src": "fontawesome"
- },
- {
- "uid": "474656633f79ea2f1dad59ff63f6bf07",
- "css": "star",
- "code": 59394,
- "src": "fontawesome"
- },
- {
- "uid": "d17030afaecc1e1c22349b99f3c4992a",
- "css": "star-empty",
- "code": 59395,
- "src": "fontawesome"
- },
- {
- "uid": "09feb4465d9bd1364f4e301c9ddbaa92",
- "css": "retweet",
- "code": 59396,
- "src": "fontawesome"
- },
- {
- "uid": "7fd683b2c518ceb9e5fa6757f2276faa",
- "css": "eye-off",
- "code": 59397,
- "src": "fontawesome"
- },
- {
- "uid": "73ffeb70554099177620847206c12457",
- "css": "binoculars",
- "code": 61925,
- "src": "fontawesome"
- },
- {
- "uid": "e99461abfef3923546da8d745372c995",
- "css": "cog",
- "code": 59399,
- "src": "fontawesome"
- },
- {
- "uid": "1bafeeb1808a5fe24484c7890096901a",
- "css": "user-plus",
- "code": 62004,
- "src": "fontawesome"
- },
- {
- "uid": "559647a6f430b3aeadbecd67194451dd",
- "css": "menu",
- "code": 61641,
- "src": "fontawesome"
- },
- {
- "uid": "0d20938846444af8deb1920dc85a29fb",
- "css": "logout",
- "code": 59400,
- "src": "fontawesome"
- },
- {
- "uid": "ccddff8e8670dcd130e3cb55fdfc2fd0",
- "css": "down-open",
- "code": 59401,
- "src": "fontawesome"
- },
- {
- "uid": "44b9e75612c5fad5505edd70d071651f",
- "css": "attach",
- "code": 59402,
- "src": "entypo"
- },
- {
- "uid": "e15f0d620a7897e2035c18c80142f6d9",
- "css": "link-ext",
- "code": 61582,
- "src": "fontawesome"
- },
- {
- "uid": "e35de5ea31cd56970498e33efbcb8e36",
- "css": "link-ext-alt",
- "code": 61583,
- "src": "fontawesome"
- },
- {
- "uid": "381da2c2f7fd51f8de877c044d7f439d",
- "css": "picture",
- "code": 59403,
- "src": "fontawesome"
- },
- {
- "uid": "872d9516df93eb6b776cc4d94bd97dac",
- "css": "video",
- "code": 59404,
- "src": "fontawesome"
- },
- {
- "uid": "399ef63b1e23ab1b761dfbb5591fa4da",
- "css": "right-open",
- "code": 59405,
- "src": "fontawesome"
- },
- {
- "uid": "d870630ff8f81e6de3958ecaeac532f2",
- "css": "left-open",
- "code": 59406,
- "src": "fontawesome"
- },
- {
- "uid": "fe6697b391355dec12f3d86d6d490397",
- "css": "up-open",
- "code": 59407,
- "src": "fontawesome"
- },
- {
- "uid": "9c1376672bb4f1ed616fdd78a23667e9",
- "css": "comment-empty",
- "code": 61669,
- "src": "fontawesome"
- },
- {
- "uid": "ccc2329632396dc096bb638d4b46fb98",
- "css": "mail-alt",
- "code": 61664,
- "src": "fontawesome"
- },
- {
- "uid": "c1f1975c885aa9f3dad7810c53b82074",
- "css": "lock",
- "code": 59409,
- "src": "fontawesome"
- },
- {
- "uid": "05376be04a27d5a46e855a233d6e8508",
- "css": "lock-open-alt",
- "code": 61758,
- "src": "fontawesome"
- },
- {
- "uid": "197375a3cea8cb90b02d06e4ddf1433d",
- "css": "globe",
- "code": 59410,
- "src": "fontawesome"
- },
- {
- "uid": "b3a9e2dab4d19ea3b2f628242c926bfe",
- "css": "brush",
- "code": 59411,
- "src": "iconic"
- },
- {
- "uid": "9dd9e835aebe1060ba7190ad2b2ed951",
- "css": "search",
- "code": 59398,
- "src": "fontawesome"
- },
- {
- "uid": "ca90da02d2c6a3183f2458e4dc416285",
- "css": "adjust",
- "code": 59414,
- "src": "fontawesome"
- },
- {
- "uid": "5e2ab018e3044337bcef5f7e94098ea1",
- "css": "thumbs-up-alt",
- "code": 61796,
- "src": "fontawesome"
- },
- {
- "uid": "c76b7947c957c9b78b11741173c8349b",
- "css": "attention",
- "code": 59412,
- "src": "fontawesome"
- },
- {
- "uid": "1a5cfa186647e8c929c2b17b9fc4dac1",
- "css": "plus-squared",
- "code": 61694,
- "src": "fontawesome"
- },
- {
- "uid": "44e04715aecbca7f266a17d5a7863c68",
- "css": "plus",
- "code": 59413,
- "src": "fontawesome"
- },
- {
- "uid": "41087bc74d4b20b55059c60a33bf4008",
- "css": "edit",
- "code": 59415,
- "src": "fontawesome"
- },
- {
- "uid": "5717236f6134afe2d2a278a5c9b3927a",
- "css": "play-circled",
- "code": 61764,
- "src": "fontawesome"
- },
- {
- "uid": "d35a1d35efeb784d1dc9ac18b9b6c2b6",
- "css": "pencil",
- "code": 59416,
- "src": "fontawesome"
- },
- {
- "uid": "266d5d9adf15a61800477a5acf9a4462",
- "css": "chart-bar",
- "code": 59419,
- "src": "fontawesome"
- },
- {
- "uid": "d862a10e1448589215be19702f98f2c1",
- "css": "smile",
- "code": 61720,
- "src": "fontawesome"
- },
- {
- "uid": "671f29fa10dda08074a4c6a341bb4f39",
- "css": "bell-alt",
- "code": 61683,
- "src": "fontawesome"
- },
- {
- "uid": "5bb103cd29de77e0e06a52638527b575",
- "css": "wrench",
- "code": 59418,
- "src": "fontawesome"
- },
- {
- "uid": "5b0772e9484a1a11646793a82edd622a",
- "css": "pin",
- "code": 59417,
- "src": "fontawesome"
- },
- {
- "uid": "22411a88489225a018f68db737de3c77",
- "css": "ellipsis",
- "code": 61761,
- "src": "custom_icons",
- "selected": true,
- "svg": {
- "path": "M214 411V518Q214 540 199 556T161 571H54Q31 571 16 556T0 518V411Q0 388 16 373T54 357H161Q183 357 199 373T214 411ZM500 411V518Q500 540 484 556T446 571H339Q317 571 301 556T286 518V411Q286 388 301 373T339 357H446Q469 357 484 373T500 411ZM786 411V518Q786 540 770 556T732 571H625Q603 571 587 556T571 518V411Q571 388 587 373T625 357H732Q755 357 770 373T786 411Z",
- "width": 785.7
- },
- "search": [
- "ellipsis"
- ]
- },
- {
- "uid": "0bef873af785ead27781fdf98b3ae740",
- "css": "bell-ringing-o",
- "code": 59408,
- "src": "custom_icons",
- "selected": true,
- "svg": {
- "path": "M497.8 0C468.3 0 444.4 23.9 444.4 53.3 444.4 61.1 446.1 68.3 448.9 75 301.7 96.7 213.3 213.3 213.3 320 213.3 588.3 117.8 712.8 35.6 782.2 35.6 821.1 67.8 853.3 106.7 853.3H355.6C355.6 931.7 419.4 995.6 497.8 995.6S640 931.7 640 853.3H888.9C927.8 853.3 960 821.1 960 782.2 877.8 712.8 782.2 588.3 782.2 320 782.2 213.3 693.9 96.7 546.7 75 549.4 68.3 551.1 61.1 551.1 53.3 551.1 23.9 527.2 0 497.8 0ZM189.4 44.8C108.4 118.6 70.5 215.1 71.1 320.2L142.2 319.8C141.7 231.2 170.4 158.3 237.3 97.4L189.4 44.8ZM806.2 44.8L758.3 97.4C825.2 158.3 853.9 231.2 853.3 319.8L924.4 320.2C925.1 215.1 887.2 118.6 806.2 44.8ZM408.9 844.4C413.9 844.4 417.8 848.3 417.8 853.3 417.8 897.2 453.9 933.3 497.8 933.3 502.8 933.3 506.7 937.2 506.7 942.2S502.8 951.1 497.8 951.1C443.9 951.1 400 907.2 400 853.3 400 848.3 403.9 844.4 408.9 844.4Z",
- "width": 1000
- },
- "search": [
- "bell-ringing-o"
- ]
- },
- {
- "uid": "0b2b66e526028a6972d51a6f10281b4b",
- "css": "zoom-in",
- "code": 59420,
- "src": "fontawesome"
- },
- {
- "uid": "0bda4bc779d4c32623dec2e43bd67ee8",
- "css": "gauge",
- "code": 61668,
- "src": "fontawesome"
- },
- {
- "uid": "31972e4e9d080eaa796290349ae6c1fd",
- "css": "users",
- "code": 59421,
- "src": "fontawesome"
- },
- {
- "uid": "e82cedfa1d5f15b00c5a81c9bd731ea2",
- "css": "info-circled",
- "code": 59423,
- "src": "fontawesome"
- },
- {
- "uid": "w3nzesrlbezu6f30q7ytyq919p6gdlb6",
- "css": "home-2",
- "code": 59425,
- "src": "typicons"
- },
- {
- "uid": "dcedf50ab1ede3283d7a6c70e2fe32f3",
- "css": "chat",
- "code": 59422,
- "src": "fontawesome"
- },
- {
- "uid": "3a00327e61b997b58518bd43ed83c3df",
- "css": "login",
- "code": 59424,
- "src": "fontawesome"
- },
- {
- "uid": "f3ebd6751c15a280af5cc5f4a764187d",
- "css": "arrow-curved",
- "code": 59426,
- "src": "iconic"
- },
- {
- "uid": "0ddd3e8201ccc7d41f7b7c9d27eca6c1",
- "css": "link",
- "code": 59427,
- "src": "fontawesome"
- },
- {
- "uid": "4aad6bb50b02c18508aae9cbe14e784e",
- "css": "share",
- "code": 61920,
- "src": "fontawesome"
- },
- {
- "uid": "8b80d36d4ef43889db10bc1f0dc9a862",
- "css": "user",
- "code": 59428,
- "src": "fontawesome"
- },
- {
- "uid": "12f4ece88e46abd864e40b35e05b11cd",
- "css": "ok",
- "code": 59431,
- "src": "fontawesome"
- },
- {
- "uid": "4109c474ff99cad28fd5a2c38af2ec6f",
- "css": "filter",
- "code": 61616,
- "src": "fontawesome"
- },
- {
- "uid": "9a76bc135eac17d2c8b8ad4a5774fc87",
- "css": "download",
- "code": 59429,
- "src": "fontawesome"
- },
- {
- "uid": "f04a5d24e9e659145b966739c4fde82a",
- "css": "bookmark",
- "code": 59430,
- "src": "fontawesome"
- },
- {
- "uid": "2f5ef6f6b7aaebc56458ab4e865beff5",
- "css": "bookmark-empty",
- "code": 61591,
- "src": "fontawesome"
- },
- {
- "uid": "9ea0a737ccc45d6c510dcbae56058849",
- "css": "music",
- "code": 59432,
- "src": "fontawesome"
- },
- {
- "uid": "1b5a5d7b7e3c71437f5a26befdd045ed",
- "css": "doc",
- "code": 59433,
- "src": "fontawesome"
- },
- {
- "uid": "98d9c83c1ee7c2c25af784b518c522c5",
- "css": "block",
- "code": 59434,
- "src": "fontawesome"
- },
- {
- "uid": "3e674995cacc2b09692c096ea7eb6165",
- "css": "megaphone",
- "code": 59435,
- "src": "fontawesome"
- }
- ]
-}
\ No newline at end of file
diff --git a/priv/static/static/js/10.46fbbdfaf0d4800f349b.js b/priv/static/static/js/10.46f441b948010eda4403.js
similarity index 71%
rename from priv/static/static/js/10.46fbbdfaf0d4800f349b.js
rename to priv/static/static/js/10.46f441b948010eda4403.js
index 0fd8463df..308d124c0 100644
Binary files a/priv/static/static/js/10.46fbbdfaf0d4800f349b.js and b/priv/static/static/js/10.46f441b948010eda4403.js differ
diff --git a/priv/static/static/js/10.46fbbdfaf0d4800f349b.js.map b/priv/static/static/js/10.46f441b948010eda4403.js.map
similarity index 56%
rename from priv/static/static/js/10.46fbbdfaf0d4800f349b.js.map
rename to priv/static/static/js/10.46f441b948010eda4403.js.map
index bee2feb10..e0623e6bf 100644
Binary files a/priv/static/static/js/10.46fbbdfaf0d4800f349b.js.map and b/priv/static/static/js/10.46f441b948010eda4403.js.map differ
diff --git a/priv/static/static/js/11.708cc2513c53879a92cc.js b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js
similarity index 99%
rename from priv/static/static/js/11.708cc2513c53879a92cc.js
rename to priv/static/static/js/11.8ff1ed54814f2d34cb3e.js
index 4fe316ecf..cb57f2a65 100644
Binary files a/priv/static/static/js/11.708cc2513c53879a92cc.js and b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js differ
diff --git a/priv/static/static/js/11.708cc2513c53879a92cc.js.map b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map
similarity index 56%
rename from priv/static/static/js/11.708cc2513c53879a92cc.js.map
rename to priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map
index 64c9320c4..4ce6d7227 100644
Binary files a/priv/static/static/js/11.708cc2513c53879a92cc.js.map and b/priv/static/static/js/11.8ff1ed54814f2d34cb3e.js.map differ
diff --git a/priv/static/static/js/12.13204bdd0ad5703a3ea3.js b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js
new file mode 100644
index 000000000..a89bfeb67
Binary files /dev/null and b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js differ
diff --git a/priv/static/static/js/12.b3bf0bc313861d6ec36b.js.map b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map
similarity index 56%
rename from priv/static/static/js/12.b3bf0bc313861d6ec36b.js.map
rename to priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map
index 28545ac96..366ec2927 100644
Binary files a/priv/static/static/js/12.b3bf0bc313861d6ec36b.js.map and b/priv/static/static/js/12.13204bdd0ad5703a3ea3.js.map differ
diff --git a/priv/static/static/js/12.b3bf0bc313861d6ec36b.js b/priv/static/static/js/12.b3bf0bc313861d6ec36b.js
deleted file mode 100644
index 4890ca10a..000000000
Binary files a/priv/static/static/js/12.b3bf0bc313861d6ec36b.js and /dev/null differ
diff --git a/priv/static/static/js/13.adb8a942514d735722c4.js b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js
similarity index 76%
rename from priv/static/static/js/13.adb8a942514d735722c4.js
rename to priv/static/static/js/13.e27c3eeddcc4b11c1f54.js
index 41abcb5a6..8cd482b41 100644
Binary files a/priv/static/static/js/13.adb8a942514d735722c4.js and b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js differ
diff --git a/priv/static/static/js/13.adb8a942514d735722c4.js.map b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map
similarity index 56%
rename from priv/static/static/js/13.adb8a942514d735722c4.js.map
rename to priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map
index 2b8ff6d6c..0c61c3fca 100644
Binary files a/priv/static/static/js/13.adb8a942514d735722c4.js.map and b/priv/static/static/js/13.e27c3eeddcc4b11c1f54.js.map differ
diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js b/priv/static/static/js/14.273855b3e4e27ce80219.js
new file mode 100644
index 000000000..78c0bfebc
Binary files /dev/null and b/priv/static/static/js/14.273855b3e4e27ce80219.js differ
diff --git a/priv/static/static/js/14.273855b3e4e27ce80219.js.map b/priv/static/static/js/14.273855b3e4e27ce80219.js.map
new file mode 100644
index 000000000..9ee527eaa
Binary files /dev/null and b/priv/static/static/js/14.273855b3e4e27ce80219.js.map differ
diff --git a/priv/static/static/js/14.d015d9b2ea16407e389c.js b/priv/static/static/js/14.d015d9b2ea16407e389c.js
deleted file mode 100644
index 200a79625..000000000
Binary files a/priv/static/static/js/14.d015d9b2ea16407e389c.js and /dev/null differ
diff --git a/priv/static/static/js/14.d015d9b2ea16407e389c.js.map b/priv/static/static/js/14.d015d9b2ea16407e389c.js.map
deleted file mode 100644
index 49dab13f7..000000000
Binary files a/priv/static/static/js/14.d015d9b2ea16407e389c.js.map and /dev/null differ
diff --git a/priv/static/static/js/15.19866e6a366ccf982284.js.map b/priv/static/static/js/15.19866e6a366ccf982284.js.map
deleted file mode 100644
index 561ab7dcf..000000000
Binary files a/priv/static/static/js/15.19866e6a366ccf982284.js.map and /dev/null differ
diff --git a/priv/static/static/js/15.19866e6a366ccf982284.js b/priv/static/static/js/15.afbe29b6665fcd015b2d.js
similarity index 98%
rename from priv/static/static/js/15.19866e6a366ccf982284.js
rename to priv/static/static/js/15.afbe29b6665fcd015b2d.js
index 0cc2e266a..b83752240 100644
Binary files a/priv/static/static/js/15.19866e6a366ccf982284.js and b/priv/static/static/js/15.afbe29b6665fcd015b2d.js differ
diff --git a/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map b/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map
new file mode 100644
index 000000000..c7a0be582
Binary files /dev/null and b/priv/static/static/js/15.afbe29b6665fcd015b2d.js.map differ
diff --git a/priv/static/static/js/16.38a984effd54736f6a2c.js.map b/priv/static/static/js/16.38a984effd54736f6a2c.js.map
deleted file mode 100644
index 68ee95f97..000000000
Binary files a/priv/static/static/js/16.38a984effd54736f6a2c.js.map and /dev/null differ
diff --git a/priv/static/static/js/16.38a984effd54736f6a2c.js b/priv/static/static/js/16.5e3f20da470591d0cabf.js
similarity index 99%
rename from priv/static/static/js/16.38a984effd54736f6a2c.js
rename to priv/static/static/js/16.5e3f20da470591d0cabf.js
index b3cebb0bd..e90ed4ca1 100644
Binary files a/priv/static/static/js/16.38a984effd54736f6a2c.js and b/priv/static/static/js/16.5e3f20da470591d0cabf.js differ
diff --git a/priv/static/static/js/16.5e3f20da470591d0cabf.js.map b/priv/static/static/js/16.5e3f20da470591d0cabf.js.map
new file mode 100644
index 000000000..0c4d0e385
Binary files /dev/null and b/priv/static/static/js/16.5e3f20da470591d0cabf.js.map differ
diff --git a/priv/static/static/js/17.9c25507194320db2e85b.js b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js
similarity index 94%
rename from priv/static/static/js/17.9c25507194320db2e85b.js
rename to priv/static/static/js/17.44e90ef82ee2ef12dc3f.js
index 451bf8bd3..9b5adfd12 100644
Binary files a/priv/static/static/js/17.9c25507194320db2e85b.js and b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js differ
diff --git a/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map
new file mode 100644
index 000000000..1d191b94a
Binary files /dev/null and b/priv/static/static/js/17.44e90ef82ee2ef12dc3f.js.map differ
diff --git a/priv/static/static/js/17.9c25507194320db2e85b.js.map b/priv/static/static/js/17.9c25507194320db2e85b.js.map
deleted file mode 100644
index f843d4400..000000000
Binary files a/priv/static/static/js/17.9c25507194320db2e85b.js.map and /dev/null differ
diff --git a/priv/static/static/js/18.94946caca48930c224c7.js.map b/priv/static/static/js/18.94946caca48930c224c7.js.map
deleted file mode 100644
index ad04b99ab..000000000
Binary files a/priv/static/static/js/18.94946caca48930c224c7.js.map and /dev/null differ
diff --git a/priv/static/static/js/18.94946caca48930c224c7.js b/priv/static/static/js/18.9a5b877f94b2b53065e1.js
similarity index 57%
rename from priv/static/static/js/18.94946caca48930c224c7.js
rename to priv/static/static/js/18.9a5b877f94b2b53065e1.js
index 5a1f40c6d..c4aea5b25 100644
Binary files a/priv/static/static/js/18.94946caca48930c224c7.js and b/priv/static/static/js/18.9a5b877f94b2b53065e1.js differ
diff --git a/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map b/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map
new file mode 100644
index 000000000..61d9a7d41
Binary files /dev/null and b/priv/static/static/js/18.9a5b877f94b2b53065e1.js.map differ
diff --git a/priv/static/static/js/19.233c81ac2c28d55e9f13.js b/priv/static/static/js/19.1fd4da643df0abf89122.js
similarity index 99%
rename from priv/static/static/js/19.233c81ac2c28d55e9f13.js
rename to priv/static/static/js/19.1fd4da643df0abf89122.js
index ace0a1d41..c1ca1643b 100644
Binary files a/priv/static/static/js/19.233c81ac2c28d55e9f13.js and b/priv/static/static/js/19.1fd4da643df0abf89122.js differ
diff --git a/priv/static/static/js/19.1fd4da643df0abf89122.js.map b/priv/static/static/js/19.1fd4da643df0abf89122.js.map
new file mode 100644
index 000000000..010c8674d
Binary files /dev/null and b/priv/static/static/js/19.1fd4da643df0abf89122.js.map differ
diff --git a/priv/static/static/js/19.233c81ac2c28d55e9f13.js.map b/priv/static/static/js/19.233c81ac2c28d55e9f13.js.map
deleted file mode 100644
index cd3f7354d..000000000
Binary files a/priv/static/static/js/19.233c81ac2c28d55e9f13.js.map and /dev/null differ
diff --git a/priv/static/static/js/2.422e6c756ac673a6fd44.js b/priv/static/static/js/2.422e6c756ac673a6fd44.js
new file mode 100644
index 000000000..9fb47e2bf
Binary files /dev/null and b/priv/static/static/js/2.422e6c756ac673a6fd44.js differ
diff --git a/priv/static/static/js/2.422e6c756ac673a6fd44.js.map b/priv/static/static/js/2.422e6c756ac673a6fd44.js.map
new file mode 100644
index 000000000..92fdb4d2c
Binary files /dev/null and b/priv/static/static/js/2.422e6c756ac673a6fd44.js.map differ
diff --git a/priv/static/static/js/2.e852a6b4b3bba752b838.js b/priv/static/static/js/2.e852a6b4b3bba752b838.js
deleted file mode 100644
index 42e446575..000000000
Binary files a/priv/static/static/js/2.e852a6b4b3bba752b838.js and /dev/null differ
diff --git a/priv/static/static/js/2.e852a6b4b3bba752b838.js.map b/priv/static/static/js/2.e852a6b4b3bba752b838.js.map
deleted file mode 100644
index d698f09e1..000000000
Binary files a/priv/static/static/js/2.e852a6b4b3bba752b838.js.map and /dev/null differ
diff --git a/priv/static/static/js/20.818c38d27369c3a4d677.js.map b/priv/static/static/js/20.818c38d27369c3a4d677.js.map
deleted file mode 100644
index 696eab20f..000000000
Binary files a/priv/static/static/js/20.818c38d27369c3a4d677.js.map and /dev/null differ
diff --git a/priv/static/static/js/20.818c38d27369c3a4d677.js b/priv/static/static/js/20.a64fd29da59076399a27.js
similarity index 99%
rename from priv/static/static/js/20.818c38d27369c3a4d677.js
rename to priv/static/static/js/20.a64fd29da59076399a27.js
index 133eac52d..eae5b3947 100644
Binary files a/priv/static/static/js/20.818c38d27369c3a4d677.js and b/priv/static/static/js/20.a64fd29da59076399a27.js differ
diff --git a/priv/static/static/js/20.a64fd29da59076399a27.js.map b/priv/static/static/js/20.a64fd29da59076399a27.js.map
new file mode 100644
index 000000000..b2917fa10
Binary files /dev/null and b/priv/static/static/js/20.a64fd29da59076399a27.js.map differ
diff --git a/priv/static/static/js/21.ce4cda179d888ca6bc2a.js b/priv/static/static/js/21.243d9e6ebf469a2dc740.js
similarity index 99%
rename from priv/static/static/js/21.ce4cda179d888ca6bc2a.js
rename to priv/static/static/js/21.243d9e6ebf469a2dc740.js
index 49700403c..61633519b 100644
Binary files a/priv/static/static/js/21.ce4cda179d888ca6bc2a.js and b/priv/static/static/js/21.243d9e6ebf469a2dc740.js differ
diff --git a/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map b/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map
new file mode 100644
index 000000000..3f98250fa
Binary files /dev/null and b/priv/static/static/js/21.243d9e6ebf469a2dc740.js.map differ
diff --git a/priv/static/static/js/21.ce4cda179d888ca6bc2a.js.map b/priv/static/static/js/21.ce4cda179d888ca6bc2a.js.map
deleted file mode 100644
index 124d58abc..000000000
Binary files a/priv/static/static/js/21.ce4cda179d888ca6bc2a.js.map and /dev/null differ
diff --git a/priv/static/static/js/22.2ea93c6cc569ef0256ab.js.map b/priv/static/static/js/22.2ea93c6cc569ef0256ab.js.map
deleted file mode 100644
index 773159f01..000000000
Binary files a/priv/static/static/js/22.2ea93c6cc569ef0256ab.js.map and /dev/null differ
diff --git a/priv/static/static/js/22.2ea93c6cc569ef0256ab.js b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js
similarity index 99%
rename from priv/static/static/js/22.2ea93c6cc569ef0256ab.js
rename to priv/static/static/js/22.e20ef7e5fefc0964cdd1.js
index 1d2077720..e8f309f8a 100644
Binary files a/priv/static/static/js/22.2ea93c6cc569ef0256ab.js and b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js differ
diff --git a/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map
new file mode 100644
index 000000000..7780cffe6
Binary files /dev/null and b/priv/static/static/js/22.e20ef7e5fefc0964cdd1.js.map differ
diff --git a/priv/static/static/js/23.a57a7845cc20fafd06d1.js b/priv/static/static/js/23.614a35f9ded445292f4a.js
similarity index 99%
rename from priv/static/static/js/23.a57a7845cc20fafd06d1.js
rename to priv/static/static/js/23.614a35f9ded445292f4a.js
index b15a888df..a35450986 100644
Binary files a/priv/static/static/js/23.a57a7845cc20fafd06d1.js and b/priv/static/static/js/23.614a35f9ded445292f4a.js differ
diff --git a/priv/static/static/js/23.614a35f9ded445292f4a.js.map b/priv/static/static/js/23.614a35f9ded445292f4a.js.map
new file mode 100644
index 000000000..4158041f4
Binary files /dev/null and b/priv/static/static/js/23.614a35f9ded445292f4a.js.map differ
diff --git a/priv/static/static/js/23.a57a7845cc20fafd06d1.js.map b/priv/static/static/js/23.a57a7845cc20fafd06d1.js.map
deleted file mode 100644
index 0e5b421e6..000000000
Binary files a/priv/static/static/js/23.a57a7845cc20fafd06d1.js.map and /dev/null differ
diff --git a/priv/static/static/js/24.35eb55a657b5485f8491.js.map b/priv/static/static/js/24.35eb55a657b5485f8491.js.map
deleted file mode 100644
index 93ffbb2e9..000000000
Binary files a/priv/static/static/js/24.35eb55a657b5485f8491.js.map and /dev/null differ
diff --git a/priv/static/static/js/24.35eb55a657b5485f8491.js b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js
similarity index 99%
rename from priv/static/static/js/24.35eb55a657b5485f8491.js
rename to priv/static/static/js/24.6ae9ca51e51e023afbe4.js
index d09d5c371..d075f3b1f 100644
Binary files a/priv/static/static/js/24.35eb55a657b5485f8491.js and b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js differ
diff --git a/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map
new file mode 100644
index 000000000..7e68d5eaa
Binary files /dev/null and b/priv/static/static/js/24.6ae9ca51e51e023afbe4.js.map differ
diff --git a/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js b/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js
deleted file mode 100644
index e96c5e6ec..000000000
Binary files a/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js and /dev/null differ
diff --git a/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js.map b/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js.map
deleted file mode 100644
index a506e6fa8..000000000
Binary files a/priv/static/static/js/25.5a9efe20e3ae1352e6d2.js.map and /dev/null differ
diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js b/priv/static/static/js/25.eadae0d48ee5be52a16c.js
new file mode 100644
index 000000000..a0e44e1aa
Binary files /dev/null and b/priv/static/static/js/25.eadae0d48ee5be52a16c.js differ
diff --git a/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map b/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map
new file mode 100644
index 000000000..aaa5e3a57
Binary files /dev/null and b/priv/static/static/js/25.eadae0d48ee5be52a16c.js.map differ
diff --git a/priv/static/static/js/26.cf13231d524e5ca3b3e6.js b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js
similarity index 99%
rename from priv/static/static/js/26.cf13231d524e5ca3b3e6.js
rename to priv/static/static/js/26.8fd0027b982c4bcdc88f.js
index adc57d6c7..3b149915b 100644
Binary files a/priv/static/static/js/26.cf13231d524e5ca3b3e6.js and b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js differ
diff --git a/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map
new file mode 100644
index 000000000..d40f1979a
Binary files /dev/null and b/priv/static/static/js/26.8fd0027b982c4bcdc88f.js.map differ
diff --git a/priv/static/static/js/26.cf13231d524e5ca3b3e6.js.map b/priv/static/static/js/26.cf13231d524e5ca3b3e6.js.map
deleted file mode 100644
index 8654bda10..000000000
Binary files a/priv/static/static/js/26.cf13231d524e5ca3b3e6.js.map and /dev/null differ
diff --git a/priv/static/static/js/27.fca8d4f6e444bd14f376.js b/priv/static/static/js/27.6d90a54efba08d261d69.js
similarity index 94%
rename from priv/static/static/js/27.fca8d4f6e444bd14f376.js
rename to priv/static/static/js/27.6d90a54efba08d261d69.js
index 9f8b5c85d..e8420a54f 100644
Binary files a/priv/static/static/js/27.fca8d4f6e444bd14f376.js and b/priv/static/static/js/27.6d90a54efba08d261d69.js differ
diff --git a/priv/static/static/js/27.6d90a54efba08d261d69.js.map b/priv/static/static/js/27.6d90a54efba08d261d69.js.map
new file mode 100644
index 000000000..6685474ce
Binary files /dev/null and b/priv/static/static/js/27.6d90a54efba08d261d69.js.map differ
diff --git a/priv/static/static/js/27.fca8d4f6e444bd14f376.js.map b/priv/static/static/js/27.fca8d4f6e444bd14f376.js.map
deleted file mode 100644
index f6ea8afc9..000000000
Binary files a/priv/static/static/js/27.fca8d4f6e444bd14f376.js.map and /dev/null differ
diff --git a/priv/static/static/js/28.e0f9f164e0bfd890dc61.js.map b/priv/static/static/js/28.e0f9f164e0bfd890dc61.js.map
deleted file mode 100644
index 536ae2d7a..000000000
Binary files a/priv/static/static/js/28.e0f9f164e0bfd890dc61.js.map and /dev/null differ
diff --git a/priv/static/static/js/28.e0f9f164e0bfd890dc61.js b/priv/static/static/js/28.f1353aa382a104262d1a.js
similarity index 98%
rename from priv/static/static/js/28.e0f9f164e0bfd890dc61.js
rename to priv/static/static/js/28.f1353aa382a104262d1a.js
index 75ba6d69d..a253284f0 100644
Binary files a/priv/static/static/js/28.e0f9f164e0bfd890dc61.js and b/priv/static/static/js/28.f1353aa382a104262d1a.js differ
diff --git a/priv/static/static/js/28.f1353aa382a104262d1a.js.map b/priv/static/static/js/28.f1353aa382a104262d1a.js.map
new file mode 100644
index 000000000..3421c9511
Binary files /dev/null and b/priv/static/static/js/28.f1353aa382a104262d1a.js.map differ
diff --git a/priv/static/static/js/29.0b69359f0fe5c0785746.js.map b/priv/static/static/js/29.0b69359f0fe5c0785746.js.map
deleted file mode 100644
index 65cd6bc82..000000000
Binary files a/priv/static/static/js/29.0b69359f0fe5c0785746.js.map and /dev/null differ
diff --git a/priv/static/static/js/29.0b69359f0fe5c0785746.js b/priv/static/static/js/29.39c1e87a689c840395b2.js
similarity index 99%
rename from priv/static/static/js/29.0b69359f0fe5c0785746.js
rename to priv/static/static/js/29.39c1e87a689c840395b2.js
index 24d73bcd5..ddb512279 100644
Binary files a/priv/static/static/js/29.0b69359f0fe5c0785746.js and b/priv/static/static/js/29.39c1e87a689c840395b2.js differ
diff --git a/priv/static/static/js/29.39c1e87a689c840395b2.js.map b/priv/static/static/js/29.39c1e87a689c840395b2.js.map
new file mode 100644
index 000000000..5901ce9b7
Binary files /dev/null and b/priv/static/static/js/29.39c1e87a689c840395b2.js.map differ
diff --git a/priv/static/static/js/3.7d21accf4e5bd07e3ebf.js b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js
similarity index 99%
rename from priv/static/static/js/3.7d21accf4e5bd07e3ebf.js
rename to priv/static/static/js/3.a0df8a5bcd120d1f8581.js
index d98aadec2..423121114 100644
Binary files a/priv/static/static/js/3.7d21accf4e5bd07e3ebf.js and b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js differ
diff --git a/priv/static/static/js/3.7d21accf4e5bd07e3ebf.js.map b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map
similarity index 99%
rename from priv/static/static/js/3.7d21accf4e5bd07e3ebf.js.map
rename to priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map
index 37826baac..653727d10 100644
Binary files a/priv/static/static/js/3.7d21accf4e5bd07e3ebf.js.map and b/priv/static/static/js/3.a0df8a5bcd120d1f8581.js.map differ
diff --git a/priv/static/static/js/30.64736585965c63c2b5d4.js b/priv/static/static/js/30.64736585965c63c2b5d4.js
new file mode 100644
index 000000000..4fdbe8c3e
Binary files /dev/null and b/priv/static/static/js/30.64736585965c63c2b5d4.js differ
diff --git a/priv/static/static/js/30.64736585965c63c2b5d4.js.map b/priv/static/static/js/30.64736585965c63c2b5d4.js.map
new file mode 100644
index 000000000..376920946
Binary files /dev/null and b/priv/static/static/js/30.64736585965c63c2b5d4.js.map differ
diff --git a/priv/static/static/js/30.fce58be0b52ca3e32fa4.js b/priv/static/static/js/30.fce58be0b52ca3e32fa4.js
deleted file mode 100644
index 03a5d65f6..000000000
Binary files a/priv/static/static/js/30.fce58be0b52ca3e32fa4.js and /dev/null differ
diff --git a/priv/static/static/js/30.fce58be0b52ca3e32fa4.js.map b/priv/static/static/js/30.fce58be0b52ca3e32fa4.js.map
deleted file mode 100644
index f7dc83701..000000000
Binary files a/priv/static/static/js/30.fce58be0b52ca3e32fa4.js.map and /dev/null differ
diff --git a/priv/static/static/js/4.5719922a4e807145346d.js b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js
similarity index 77%
rename from priv/static/static/js/4.5719922a4e807145346d.js
rename to priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js
index 91ea2ac5e..4da4c56fa 100644
Binary files a/priv/static/static/js/4.5719922a4e807145346d.js and b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js differ
diff --git a/priv/static/static/js/4.5719922a4e807145346d.js.map b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map
similarity index 99%
rename from priv/static/static/js/4.5719922a4e807145346d.js.map
rename to priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map
index d5e592cfd..bc040ab9b 100644
Binary files a/priv/static/static/js/4.5719922a4e807145346d.js.map and b/priv/static/static/js/4.4cde7fdd1fe6bf2a9499.js.map differ
diff --git a/priv/static/static/js/5.cf05c5ddbdbac890ae35.js b/priv/static/static/js/5.2e165bc072548e533dd4.js
similarity index 98%
rename from priv/static/static/js/5.cf05c5ddbdbac890ae35.js
rename to priv/static/static/js/5.2e165bc072548e533dd4.js
index f54d67fb3..cfd84226c 100644
Binary files a/priv/static/static/js/5.cf05c5ddbdbac890ae35.js and b/priv/static/static/js/5.2e165bc072548e533dd4.js differ
diff --git a/priv/static/static/js/5.cf05c5ddbdbac890ae35.js.map b/priv/static/static/js/5.2e165bc072548e533dd4.js.map
similarity index 57%
rename from priv/static/static/js/5.cf05c5ddbdbac890ae35.js.map
rename to priv/static/static/js/5.2e165bc072548e533dd4.js.map
index 77f2d0898..49959c78e 100644
Binary files a/priv/static/static/js/5.cf05c5ddbdbac890ae35.js.map and b/priv/static/static/js/5.2e165bc072548e533dd4.js.map differ
diff --git a/priv/static/static/js/6.260ccd84f8cd2af27970.js b/priv/static/static/js/6.260ccd84f8cd2af27970.js
new file mode 100644
index 000000000..fb4a690f4
Binary files /dev/null and b/priv/static/static/js/6.260ccd84f8cd2af27970.js differ
diff --git a/priv/static/static/js/6.ecfd3302a692de148391.js.map b/priv/static/static/js/6.260ccd84f8cd2af27970.js.map
similarity index 57%
rename from priv/static/static/js/6.ecfd3302a692de148391.js.map
rename to priv/static/static/js/6.260ccd84f8cd2af27970.js.map
index a17c7d297..850fe731a 100644
Binary files a/priv/static/static/js/6.ecfd3302a692de148391.js.map and b/priv/static/static/js/6.260ccd84f8cd2af27970.js.map differ
diff --git a/priv/static/static/js/6.ecfd3302a692de148391.js b/priv/static/static/js/6.ecfd3302a692de148391.js
deleted file mode 100644
index 354243ec2..000000000
Binary files a/priv/static/static/js/6.ecfd3302a692de148391.js and /dev/null differ
diff --git a/priv/static/static/js/7.dd44c3d58fb9dced093d.js b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js
similarity index 99%
rename from priv/static/static/js/7.dd44c3d58fb9dced093d.js
rename to priv/static/static/js/7.1c41eff6cfc75a00bde4.js
index cb95efc73..317770a53 100644
Binary files a/priv/static/static/js/7.dd44c3d58fb9dced093d.js and b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js differ
diff --git a/priv/static/static/js/7.dd44c3d58fb9dced093d.js.map b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map
similarity index 57%
rename from priv/static/static/js/7.dd44c3d58fb9dced093d.js.map
rename to priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map
index ae7e35d5d..36f327b3f 100644
Binary files a/priv/static/static/js/7.dd44c3d58fb9dced093d.js.map and b/priv/static/static/js/7.1c41eff6cfc75a00bde4.js.map differ
diff --git a/priv/static/static/js/8.636322a87bb10a1754f8.js b/priv/static/static/js/8.9b35c2fee24ab7481e00.js
similarity index 99%
rename from priv/static/static/js/8.636322a87bb10a1754f8.js
rename to priv/static/static/js/8.9b35c2fee24ab7481e00.js
index 6e635fb6a..cb7844ffc 100644
Binary files a/priv/static/static/js/8.636322a87bb10a1754f8.js and b/priv/static/static/js/8.9b35c2fee24ab7481e00.js differ
diff --git a/priv/static/static/js/8.636322a87bb10a1754f8.js.map b/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map
similarity index 57%
rename from priv/static/static/js/8.636322a87bb10a1754f8.js.map
rename to priv/static/static/js/8.9b35c2fee24ab7481e00.js.map
index f074928a5..65f4d5ae9 100644
Binary files a/priv/static/static/js/8.636322a87bb10a1754f8.js.map and b/priv/static/static/js/8.9b35c2fee24ab7481e00.js.map differ
diff --git a/priv/static/static/js/9.3a29094f1886648a0af3.js b/priv/static/static/js/9.3a29094f1886648a0af3.js
new file mode 100644
index 000000000..eb3516dcd
Binary files /dev/null and b/priv/static/static/js/9.3a29094f1886648a0af3.js differ
diff --git a/priv/static/static/js/9.3a29094f1886648a0af3.js.map b/priv/static/static/js/9.3a29094f1886648a0af3.js.map
new file mode 100644
index 000000000..1b6224a6a
Binary files /dev/null and b/priv/static/static/js/9.3a29094f1886648a0af3.js.map differ
diff --git a/priv/static/static/js/9.6010dbcce7b4d7c05a18.js b/priv/static/static/js/9.6010dbcce7b4d7c05a18.js
deleted file mode 100644
index fcad39a7e..000000000
Binary files a/priv/static/static/js/9.6010dbcce7b4d7c05a18.js and /dev/null differ
diff --git a/priv/static/static/js/9.6010dbcce7b4d7c05a18.js.map b/priv/static/static/js/9.6010dbcce7b4d7c05a18.js.map
deleted file mode 100644
index e5e1cd823..000000000
Binary files a/priv/static/static/js/9.6010dbcce7b4d7c05a18.js.map and /dev/null differ
diff --git a/priv/static/static/js/app.45547c05212c403dd77c.js b/priv/static/static/js/app.45547c05212c403dd77c.js
new file mode 100644
index 000000000..219a59493
Binary files /dev/null and b/priv/static/static/js/app.45547c05212c403dd77c.js differ
diff --git a/priv/static/static/js/app.45547c05212c403dd77c.js.map b/priv/static/static/js/app.45547c05212c403dd77c.js.map
new file mode 100644
index 000000000..e1dd6c992
Binary files /dev/null and b/priv/static/static/js/app.45547c05212c403dd77c.js.map differ
diff --git a/priv/static/static/js/app.826c44232e0a76bbd9ba.js b/priv/static/static/js/app.826c44232e0a76bbd9ba.js
deleted file mode 100644
index 16762165e..000000000
Binary files a/priv/static/static/js/app.826c44232e0a76bbd9ba.js and /dev/null differ
diff --git a/priv/static/static/js/app.826c44232e0a76bbd9ba.js.map b/priv/static/static/js/app.826c44232e0a76bbd9ba.js.map
deleted file mode 100644
index b188c3379..000000000
Binary files a/priv/static/static/js/app.826c44232e0a76bbd9ba.js.map and /dev/null differ
diff --git a/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js b/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js
deleted file mode 100644
index 879a3b312..000000000
Binary files a/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js and /dev/null differ
diff --git a/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js.map b/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js.map
deleted file mode 100644
index 395f83b6b..000000000
Binary files a/priv/static/static/js/vendors~app.90c4af83c1ae68f4cd95.js.map and /dev/null differ
diff --git a/priv/static/static/js/vendors~app.952124344a84613dbac0.js b/priv/static/static/js/vendors~app.952124344a84613dbac0.js
new file mode 100644
index 000000000..f7943c122
Binary files /dev/null and b/priv/static/static/js/vendors~app.952124344a84613dbac0.js differ
diff --git a/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map b/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map
new file mode 100644
index 000000000..05fc07c18
Binary files /dev/null and b/priv/static/static/js/vendors~app.952124344a84613dbac0.js.map differ
diff --git a/priv/static/static/logo.svg b/priv/static/static/logo.svg
new file mode 100644
index 000000000..68e647e6c
--- /dev/null
+++ b/priv/static/static/logo.svg
@@ -0,0 +1,71 @@
+
+
+
+
+
+ image/svg+xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/priv/static/static/terms-of-service.html b/priv/static/static/terms-of-service.html
index 3b6bbb36b..2b7bf7697 100644
--- a/priv/static/static/terms-of-service.html
+++ b/priv/static/static/terms-of-service.html
@@ -6,4 +6,4 @@
Pleroma install containing the real ToS for your instance.
See the Pleroma documentation for more information.
-
+
diff --git a/priv/static/sw-pleroma.js b/priv/static/sw-pleroma.js
index fa4969025..385ee2f0c 100644
Binary files a/priv/static/sw-pleroma.js and b/priv/static/sw-pleroma.js differ
diff --git a/priv/static/sw-pleroma.js.map b/priv/static/sw-pleroma.js.map
index cd5ea0ae6..0b6a76c2f 100644
Binary files a/priv/static/sw-pleroma.js.map and b/priv/static/sw-pleroma.js.map differ
diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex
index cdddc47ea..2f5952ef1 100644
--- a/priv/templates/sample_config.eex
+++ b/priv/templates/sample_config.eex
@@ -32,8 +32,7 @@ config :pleroma, Pleroma.Repo,
username: "<%= dbuser %>",
password: "<%= dbpass %>",
database: "<%= dbname %>",
- hostname: "<%= dbhost %>",
- pool_size: 10
+ hostname: "<%= dbhost %>"
# Configure web push notifications
config :web_push_encryption, :vapid_details,
diff --git a/test/fixtures/mastodon-delete.json b/test/fixtures/mastodon-delete.json
index 87a582002..8559f724e 100644
--- a/test/fixtures/mastodon-delete.json
+++ b/test/fixtures/mastodon-delete.json
@@ -2,12 +2,9 @@
"type": "Delete",
"signature": {
"type": "RsaSignature2017",
- "signatureValue": "cw0RlfNREf+5VdsOYcCBDrv521eiLsDTAYNHKffjF0bozhCnOh+wHkFik7WamUk$
-uEiN4L2H6vPlGRprAZGRhEwgy+A7rIFQNmLrpW5qV5UNVI/2F7kngEHqZQgbQYj9hW+5GMYmPkHdv3D72ZefGw$
-4Xa2NBLGFpAjQllfzt7kzZLKKY2DM99FdUa64I2Wj3iD04Hs23SbrUdAeuGk/c1Cg6bwGNG4vxoiwn1jikgJLA$
-NAlSGjsRGdR7LfbC7GqWWsW3cSNsLFPoU6FyALjgTrrYoHiXe0QHggw+L3yMLfzB2S/L46/VRbyb+WDKMBIXUL$
-5owmzHSi6e/ZtCI3w==",
- "creator": "http://mastodon.example.org/users/gargron#main-key", "created": "2018-03-03T16:24:11Z"
+ "signatureValue": "cw0RlfNREf+5VdsOYcCBDrv521eiLsDTAYNHKffjF0bozhCnOh+wHkFik7WamUk$uEiN4L2H6vPlGRprAZGRhEwgy+A7rIFQNmLrpW5qV5UNVI/2F7kngEHqZQgbQYj9hW+5GMYmPkHdv3D72ZefGw$4Xa2NBLGFpAjQllfzt7kzZLKKY2DM99FdUa64I2Wj3iD04Hs23SbrUdAeuGk/c1Cg6bwGNG4vxoiwn1jikgJLA$NAlSGjsRGdR7LfbC7GqWWsW3cSNsLFPoU6FyALjgTrrYoHiXe0QHggw+L3yMLfzB2S/L46/VRbyb+WDKMBIXUL$5owmzHSi6e/ZtCI3w==",
+ "creator": "http://mastodon.example.org/users/gargron#main-key",
+ "created": "2018-03-03T16:24:11Z"
},
"object": {
"type": "Tombstone",
diff --git a/test/fixtures/mastodon/application_actor.json b/test/fixtures/mastodon/application_actor.json
new file mode 100644
index 000000000..2089ea049
--- /dev/null
+++ b/test/fixtures/mastodon/application_actor.json
@@ -0,0 +1,67 @@
+{
+ "@context": [
+ "https://www.w3.org/ns/activitystreams",
+ "https://w3id.org/security/v1",
+ {
+ "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
+ "toot": "http://joinmastodon.org/ns#",
+ "featured": {
+ "@id": "toot:featured",
+ "@type": "@id"
+ },
+ "alsoKnownAs": {
+ "@id": "as:alsoKnownAs",
+ "@type": "@id"
+ },
+ "movedTo": {
+ "@id": "as:movedTo",
+ "@type": "@id"
+ },
+ "schema": "http://schema.org#",
+ "PropertyValue": "schema:PropertyValue",
+ "value": "schema:value",
+ "IdentityProof": "toot:IdentityProof",
+ "discoverable": "toot:discoverable",
+ "Device": "toot:Device",
+ "Ed25519Signature": "toot:Ed25519Signature",
+ "Ed25519Key": "toot:Ed25519Key",
+ "Curve25519Key": "toot:Curve25519Key",
+ "EncryptedMessage": "toot:EncryptedMessage",
+ "publicKeyBase64": "toot:publicKeyBase64",
+ "deviceId": "toot:deviceId",
+ "claim": {
+ "@type": "@id",
+ "@id": "toot:claim"
+ },
+ "fingerprintKey": {
+ "@type": "@id",
+ "@id": "toot:fingerprintKey"
+ },
+ "identityKey": {
+ "@type": "@id",
+ "@id": "toot:identityKey"
+ },
+ "devices": {
+ "@type": "@id",
+ "@id": "toot:devices"
+ },
+ "messageFranking": "toot:messageFranking",
+ "messageType": "toot:messageType",
+ "cipherText": "toot:cipherText"
+ }
+ ],
+ "id": "https://{{DOMAIN}}/actor",
+ "type": "Application",
+ "inbox": "https://{{DOMAIN}}/actor/inbox",
+ "preferredUsername": "{{DOMAIN}}",
+ "url": "https://{{DOMAIN}}/about/more?instance_actor=true",
+ "manuallyApprovesFollowers": true,
+ "publicKey": {
+ "id": "https://{{DOMAIN}}/actor#main-key",
+ "owner": "https://{{DOMAIN}}/actor",
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAA0CA08AMIIBCgKCAQEAyi2T2FFZJgRPY+96YQrn\n6J6eF2P60J+nz+/pRc/acv/Nx+NLxxPyXby0F2s60MV7uALRQbBBnf7oNKCd/T4S\nvbr7UXMCWTdaJBpYubMKWT9uBlaUUkUfqL+WTV+IQnlcKtssQ4+AwrAKAZXza8ws\nZypevOsLHzayyEzztmm1KQC9GCUOITCLf7Q6qEhy8z/HuqLBEC0Own0pD7QsbfcS\no1peuZY7g1E/jJ9HR9GqJccMaR0H28KmJ7tT1Yzlyf5uZMRIdPxsoMR9sGLjR2B8\noegSwaf9SogR3ScP395Tt/9Ud1VVzuhpoS8Uy7jKSs+3CuLJsEGoMrib8VyOwadS\n9wIDAQAB\n-----END PUBLIC KEY-----\n"
+ },
+ "endpoints": {
+ "sharedInbox": "https://{{DOMAIN}}/inbox"
+ }
+}
diff --git a/test/fixtures/modules/good_mrf.ex b/test/fixtures/modules/good_mrf.ex
new file mode 100644
index 000000000..39d0f14ec
--- /dev/null
+++ b/test/fixtures/modules/good_mrf.ex
@@ -0,0 +1,19 @@
+defmodule Fixtures.Modules.GoodMRF do
+ @behaviour Pleroma.Web.ActivityPub.MRF
+
+ @impl true
+ def filter(a), do: {:ok, a}
+
+ @impl true
+ def describe, do: %{}
+
+ @impl true
+ def config_description do
+ %{
+ key: :good_mrf,
+ related_policy: "Fixtures.Modules.GoodMRF",
+ label: "Good MRF",
+ description: "Some description"
+ }
+ end
+end
diff --git a/test/fixtures/osada-follow-activity.json b/test/fixtures/osada-follow-activity.json
index b991eea36..be10ce88f 100644
--- a/test/fixtures/osada-follow-activity.json
+++ b/test/fixtures/osada-follow-activity.json
@@ -1,56 +1,52 @@
{
- "@context":[
+ "@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1",
"https://apfed.club/apschema/v1.4"
],
- "id":"https://apfed.club/follow/9",
- "type":"Follow",
- "actor":{
- "type":"Person",
- "id":"https://apfed.club/channel/indio",
- "preferredUsername":"indio",
- "name":"Indio",
- "updated":"2019-08-20T23:52:34Z",
- "icon":{
- "type":"Image",
- "mediaType":"image/jpeg",
- "updated":"2019-08-20T23:53:37Z",
- "url":"https://apfed.club/photo/profile/l/2",
- "height":300,
- "width":300
+ "id": "https://apfed.club/follow/9",
+ "type": "Follow",
+ "actor": {
+ "type": "Person",
+ "id": "https://apfed.club/channel/indio",
+ "preferredUsername": "indio",
+ "name": "Indio",
+ "updated": "2019-08-20T23:52:34Z",
+ "icon": {
+ "type": "Image",
+ "mediaType": "image/jpeg",
+ "updated": "2019-08-20T23:53:37Z",
+ "url": "https://apfed.club/photo/profile/l/2",
+ "height": 300,
+ "width": 300
},
- "url":"https://apfed.club/channel/indio",
- "inbox":"https://apfed.club/inbox/indio",
- "outbox":"https://apfed.club/outbox/indio",
- "followers":"https://apfed.club/followers/indio",
- "following":"https://apfed.club/following/indio",
- "endpoints":{
- "sharedInbox":"https://apfed.club/inbox"
+ "url": "https://apfed.club/channel/indio",
+ "inbox": "https://apfed.club/inbox/indio",
+ "outbox": "https://apfed.club/outbox/indio",
+ "followers": "https://apfed.club/followers/indio",
+ "following": "https://apfed.club/following/indio",
+ "endpoints": {
+ "sharedInbox": "https://apfed.club/inbox"
},
- "publicKey":{
- "id":"https://apfed.club/channel/indio",
- "owner":"https://apfed.club/channel/indio",
- "publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA77TIR1VuSYFnmDRFGHHb\n4vaGdx9ranzRX4bfOKAqa++Ch5L4EqJpPy08RuM+NrYCYiYl4QQFDSSDXAEgb5g9\nC1TgWTfI7q/E0UBX2Vr0mU6X4i1ztv0tuQvegRjcSJ7l1AvoBs8Ip4MEJ3OPEQhB\ngJqAACB3Gnps4zi2I0yavkxUfGVKr6zKT3BxWh5hTpKC7Do+ChIrVZC2EwxND9K6
-\nsAnQHThcb5EQuvuzUQZKeS7IEOsd0JpZDmJjbfMGrAWE81pLIfEeeA2joCJiBBTO\nglDsW+juvZ+lWqJpMr2hMWpvfrFjJeUawNJCIzsLdVIZR+aKj5yy6yqoS8hkN9Ha\n1MljZpsXl+EmwcwAIqim1YeLwERCEAQ/JWbSt8pQTQbzZ6ibwQ4mchCxacrRbIVR
-\nnL59fWMBassJcbY0VwrTugm2SBsYbDjESd55UZV03Rwr8qseGTyi+hH8O7w2SIaY\nzjN6AdZiPmsh00YflzlCk8MSLOHMol1vqIUzXxU8CdXn9+KsuQdZGrTz0YKN/db4\naVwUGJatz2Tsvf7R1tJBjJfeQWOWbbn3pycLVH86LjZ83qngp9ZVnAveUnUqz0yS
-\nhe+buZ6UMsfGzbIYon2bKNlz6gYTH0YPcr+cLe+29drtt0GZiXha1agbpo4RB8zE
-\naNL2fucF5YT0yNpbd/5WoV0CAwEAAQ==\n-----END PUBLIC KEY-----\n"
+ "publicKey": {
+ "id": "https://apfed.club/channel/indio",
+ "owner": "https://apfed.club/channel/indio",
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA77TIR1VuSYFnmDRFGHHb\n4vaGdx9ranzRX4bfOKAqa++Ch5L4EqJpPy08RuM+NrYCYiYl4QQFDSSDXAEgb5g9\nC1TgWTfI7q/E0UBX2Vr0mU6X4i1ztv0tuQvegRjcSJ7l1AvoBs8Ip4MEJ3OPEQhB\ngJqAACB3Gnps4zi2I0yavkxUfGVKr6zKT3BxWh5hTpKC7Do+ChIrVZC2EwxND9K6\nsAnQHThcb5EQuvuzUQZKeS7IEOsd0JpZDmJjbfMGrAWE81pLIfEeeA2joCJiBBTO\nglDsW+juvZ+lWqJpMr2hMWpvfrFjJeUawNJCIzsLdVIZR+aKj5yy6yqoS8hkN9Ha\n1MljZpsXl+EmwcwAIqim1YeLwERCEAQ/JWbSt8pQTQbzZ6ibwQ4mchCxacrRbIVR\nnL59fWMBassJcbY0VwrTugm2SBsYbDjESd55UZV03Rwr8qseGTyi+hH8O7w2SIaY\nzjN6AdZiPmsh00YflzlCk8MSLOHMol1vqIUzXxU8CdXn9+KsuQdZGrTz0YKN/db4\naVwUGJatz2Tsvf7R1tJBjJfeQWOWbbn3pycLVH86LjZ83qngp9ZVnAveUnUqz0yS\nhe+buZ6UMsfGzbIYon2bKNlz6gYTH0YPcr+cLe+29drtt0GZiXha1agbpo4RB8zE\naNL2fucF5YT0yNpbd/5WoV0CAwEAAQ==\n-----END PUBLIC KEY-----\n"
}
},
- "object":"https://pleroma.site/users/kaniini",
- "to":[
+ "object": "https://pleroma.site/users/kaniini",
+ "to": [
"https://pleroma.site/users/kaniini"
],
- "signature":{
- "@context":[
+ "signature": {
+ "@context": [
"https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1"
],
- "type":"RsaSignature2017",
- "nonce":"52c035e0a9e81dce8b486159204e97c22637e91f75cdfad5378de91de68e9117",
- "creator":"https://apfed.club/channel/indio/public_key_pem",
- "created":"2019-08-22T03:38:02Z",
- "signatureValue":"oVliRCIqNIh6yUp851dYrF0y21aHp3Rz6VkIpW1pFMWfXuzExyWSfcELpyLseeRmsw5bUu9zJkH44B4G2LiJQKA9UoEQDjrDMZBmbeUpiQqq3DVUzkrBOI8bHZ7xyJ/CjSZcNHHh0MHhSKxswyxWMGi4zIqzkAZG3vRRgoPVHdjPm00sR3B8jBLw1cjoffv+KKeM/zEUpe13gqX9qHAWHHqZepxgSWmq+EKOkRvHUPBXiEJZfXzc5uW+vZ09F3WBYmaRoy8Y0e1P29fnRLqSy7EEINdrHaGclRqoUZyiawpkgy3lWWlynesV/HiLBR7EXT79eKstxf4wfTDaPKBCfTCsOWuMWHr7Genu37ew2/t7eiBGqCwwW12ylhml/OLHgNK3LOhmRABhtfpaFZSxfDVnlXfaLpY1xekVOj2oC0FpBtnoxVKLpIcyLw6dkfSil5ANd+hl59W/bpPA8KT90ii1fSNCo3+FcwQVx0YsPznJNA60XfFuVsme7zNcOst6393e1WriZxBanFpfB63zVQc9u1fjyfktx/yiUNxIlre+sz9OCc0AACn94iRhBYh4bbzdleUOTnM7lnD4Dj2FP+xeDIP8CA8wXUeq5+9kopSp2kAmlUEyFUdg4no7naIeu1SZnopfUg56PsVCp9JHiUK1SYAyWbdC+FbUECu5CvI="
+ "type": "RsaSignature2017",
+ "nonce": "52c035e0a9e81dce8b486159204e97c22637e91f75cdfad5378de91de68e9117",
+ "creator": "https://apfed.club/channel/indio/public_key_pem",
+ "created": "2019-08-22T03:38:02Z",
+ "signatureValue": "oVliRCIqNIh6yUp851dYrF0y21aHp3Rz6VkIpW1pFMWfXuzExyWSfcELpyLseeRmsw5bUu9zJkH44B4G2LiJQKA9UoEQDjrDMZBmbeUpiQqq3DVUzkrBOI8bHZ7xyJ/CjSZcNHHh0MHhSKxswyxWMGi4zIqzkAZG3vRRgoPVHdjPm00sR3B8jBLw1cjoffv+KKeM/zEUpe13gqX9qHAWHHqZepxgSWmq+EKOkRvHUPBXiEJZfXzc5uW+vZ09F3WBYmaRoy8Y0e1P29fnRLqSy7EEINdrHaGclRqoUZyiawpkgy3lWWlynesV/HiLBR7EXT79eKstxf4wfTDaPKBCfTCsOWuMWHr7Genu37ew2/t7eiBGqCwwW12ylhml/OLHgNK3LOhmRABhtfpaFZSxfDVnlXfaLpY1xekVOj2oC0FpBtnoxVKLpIcyLw6dkfSil5ANd+hl59W/bpPA8KT90ii1fSNCo3+FcwQVx0YsPznJNA60XfFuVsme7zNcOst6393e1WriZxBanFpfB63zVQc9u1fjyfktx/yiUNxIlre+sz9OCc0AACn94iRhBYh4bbzdleUOTnM7lnD4Dj2FP+xeDIP8CA8wXUeq5+9kopSp2kAmlUEyFUdg4no7naIeu1SZnopfUg56PsVCp9JHiUK1SYAyWbdC+FbUECu5CvI="
}
}
diff --git a/test/fixtures/spoofed-object.json b/test/fixtures/spoofed-object.json
new file mode 100644
index 000000000..91e34307d
--- /dev/null
+++ b/test/fixtures/spoofed-object.json
@@ -0,0 +1,26 @@
+{
+ "@context": [
+ "https://www.w3.org/ns/activitystreams",
+ "https://patch.cx/schemas/litepub-0.1.jsonld",
+ {
+ "@language": "und"
+ }
+ ],
+ "actor": "https://patch.cx/users/rin",
+ "attachment": [],
+ "attributedTo": "https://patch.cx/users/rin",
+ "cc": [
+ "https://patch.cx/users/rin/followers"
+ ],
+ "content": "Oracle Corporation (NYSE: ORCL) today announced that it has signed a definitive merger agreement to acquire Pleroma AG (FRA: PLA), for $26.50 per share (approximately $10.3 billion). The transaction has been approved by the boards of directors of both companies and should close by early January.",
+ "context": "https://patch.cx/contexts/spoof",
+ "id": "https://patch.cx/objects/spoof",
+ "published": "2020-10-23T18:02:06.038856Z",
+ "sensitive": false,
+ "summary": "Oracle buys Pleroma",
+ "tag": [],
+ "to": [
+ "https://www.w3.org/ns/activitystreams#Public"
+ ],
+ "type": "Note"
+}
diff --git a/test/mix/tasks/pleroma/config_test.exs b/test/mix/tasks/pleroma/config_test.exs
index f36648829..0280d208d 100644
--- a/test/mix/tasks/pleroma/config_test.exs
+++ b/test/mix/tasks/pleroma/config_test.exs
@@ -7,6 +7,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
import Pleroma.Factory
+ alias Mix.Tasks.Pleroma.Config, as: MixTask
alias Pleroma.ConfigDB
alias Pleroma.Repo
@@ -22,30 +23,41 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
:ok
end
- setup_all do: clear_config(:configurable_from_database, true)
+ defp config_records do
+ ConfigDB
+ |> Repo.all()
+ |> Enum.sort()
+ end
+
+ defp insert_config_record(group, key, value) do
+ insert(:config,
+ group: group,
+ key: key,
+ value: value
+ )
+ end
test "error if file with custom settings doesn't exist" do
- Mix.Tasks.Pleroma.Config.migrate_to_db("config/not_existance_config_file.exs")
+ MixTask.migrate_to_db("config/non_existent_config_file.exs")
- assert_receive {:mix_shell, :info,
- [
- "To migrate settings, you must define custom settings in config/not_existance_config_file.exs."
- ]},
- 15
+ msg =
+ "To migrate settings, you must define custom settings in config/non_existent_config_file.exs."
+
+ assert_receive {:mix_shell, :info, [^msg]}, 15
end
describe "migrate_to_db/1" do
setup do
- initial = Application.get_env(:quack, :level)
- on_exit(fn -> Application.put_env(:quack, :level, initial) end)
+ clear_config(:configurable_from_database, true)
+ clear_config([:quack, :level])
end
@tag capture_log: true
test "config migration refused when deprecated settings are found" do
clear_config([:media_proxy, :whitelist], ["domain_without_scheme.com"])
- assert Repo.all(ConfigDB) == []
+ assert config_records() == []
- Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs")
+ MixTask.migrate_to_db("test/fixtures/config/temp.secret.exs")
assert_received {:mix_shell, :error, [message]}
@@ -54,9 +66,9 @@ test "config migration refused when deprecated settings are found" do
end
test "filtered settings are migrated to db" do
- assert Repo.all(ConfigDB) == []
+ assert config_records() == []
- Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs")
+ MixTask.migrate_to_db("test/fixtures/config/temp.secret.exs")
config1 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":first_setting"})
config2 = ConfigDB.get_by_params(%{group: ":pleroma", key: ":second_setting"})
@@ -71,18 +83,19 @@ test "filtered settings are migrated to db" do
end
test "config table is truncated before migration" do
- insert(:config, key: :first_setting, value: [key: "value", key2: ["Activity"]])
- assert Repo.aggregate(ConfigDB, :count, :id) == 1
+ insert_config_record(:pleroma, :first_setting, key: "value", key2: ["Activity"])
+ assert length(config_records()) == 1
- Mix.Tasks.Pleroma.Config.migrate_to_db("test/fixtures/config/temp.secret.exs")
+ MixTask.migrate_to_db("test/fixtures/config/temp.secret.exs")
config = ConfigDB.get_by_params(%{group: ":pleroma", key: ":first_setting"})
assert config.value == [key: "value", key2: [Repo]]
end
end
- describe "with deletion temp file" do
+ describe "with deletion of temp file" do
setup do
+ clear_config(:configurable_from_database, true)
temp_file = "config/temp.exported_from_db.secret.exs"
on_exit(fn ->
@@ -93,13 +106,13 @@ test "config table is truncated before migration" do
end
test "settings are migrated to file and deleted from db", %{temp_file: temp_file} do
- insert(:config, key: :setting_first, value: [key: "value", key2: ["Activity"]])
- insert(:config, key: :setting_second, value: [key: "value2", key2: [Repo]])
- insert(:config, group: :quack, key: :level, value: :info)
+ insert_config_record(:pleroma, :setting_first, key: "value", key2: ["Activity"])
+ insert_config_record(:pleroma, :setting_second, key: "value2", key2: [Repo])
+ insert_config_record(:quack, :level, :info)
- Mix.Tasks.Pleroma.Config.run(["migrate_from_db", "--env", "temp", "-d"])
+ MixTask.run(["migrate_from_db", "--env", "temp", "-d"])
- assert Repo.all(ConfigDB) == []
+ assert config_records() == []
file = File.read!(temp_file)
assert file =~ "config :pleroma, :setting_first,"
@@ -169,9 +182,9 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil
]
)
- Mix.Tasks.Pleroma.Config.run(["migrate_from_db", "--env", "temp", "-d"])
+ MixTask.run(["migrate_from_db", "--env", "temp", "-d"])
- assert Repo.all(ConfigDB) == []
+ assert config_records() == []
assert File.exists?(temp_file)
{:ok, file} = File.read(temp_file)
@@ -186,4 +199,114 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil
"#{header}\n\nconfig :pleroma, :instance,\n name: \"Pleroma\",\n email: \"example@example.com\",\n notify_email: \"noreply@example.com\",\n description: \"A Pleroma instance, an alternative fediverse server\",\n limit: 5000,\n chat_limit: 5000,\n remote_limit: 100_000,\n upload_limit: 16_000_000,\n avatar_upload_limit: 2_000_000,\n background_upload_limit: 4_000_000,\n banner_upload_limit: 4_000_000,\n poll_limits: %{\n max_expiration: 31_536_000,\n max_option_chars: 200,\n max_options: 20,\n min_expiration: 0\n },\n registrations_open: true,\n federating: true,\n federation_incoming_replies_max_depth: 100,\n federation_reachability_timeout_days: 7,\n federation_publisher_modules: [Pleroma.Web.ActivityPub.Publisher],\n allow_relay: true,\n public: true,\n quarantined_instances: [],\n managed_config: true,\n static_dir: \"instance/static/\",\n allowed_post_formats: [\"text/plain\", \"text/html\", \"text/markdown\", \"text/bbcode\"],\n autofollowed_nicknames: [],\n max_pinned_statuses: 1,\n attachment_links: false,\n max_report_comment_size: 1000,\n safe_dm_mentions: false,\n healthcheck: false,\n remote_post_retention_days: 90,\n skip_thread_containment: true,\n limit_to_local_content: :unauthenticated,\n user_bio_length: 5000,\n user_name_length: 100,\n max_account_fields: 10,\n max_remote_account_fields: 20,\n account_field_name_length: 512,\n account_field_value_length: 2048,\n external_user_synchronization: true,\n extended_nickname_format: true,\n multi_factor_authentication: [\n totp: [digits: 6, period: 30],\n backup_codes: [number: 2, length: 6]\n ]\n"
end
end
+
+ describe "operations on database config" do
+ setup do: clear_config(:configurable_from_database, true)
+
+ test "dumping a specific group" do
+ insert_config_record(:pleroma, :instance, name: "Pleroma Test")
+
+ insert_config_record(:web_push_encryption, :vapid_details,
+ subject: "mailto:administrator@example.com",
+ public_key:
+ "BOsPL-_KjNnjj_RMvLeR3dTOrcndi4TbMR0cu56gLGfGaT5m1gXxSfRHOcC4Dd78ycQL1gdhtx13qgKHmTM5xAI",
+ private_key: "Ism6FNdS31nLCA94EfVbJbDdJXCxAZ8cZiB1JQPN_t4"
+ )
+
+ MixTask.run(["dump", "pleroma"])
+
+ assert_receive {:mix_shell, :info,
+ ["config :pleroma, :instance, [name: \"Pleroma Test\"]\r\n\r\n"]}
+
+ refute_receive {
+ :mix_shell,
+ :info,
+ [
+ "config :web_push_encryption, :vapid_details, [subject: \"mailto:administrator@example.com\", public_key: \"BOsPL-_KjNnjj_RMvLeR3dTOrcndi4TbMR0cu56gLGfGaT5m1gXxSfRHOcC4Dd78ycQL1gdhtx13qgKHmTM5xAI\", private_key: \"Ism6FNdS31nLCA94EfVbJbDdJXCxAZ8cZiB1JQPN_t4\"]\r\n\r\n"
+ ]
+ }
+
+ # Ensure operations work when using atom syntax
+ MixTask.run(["dump", ":pleroma"])
+
+ assert_receive {:mix_shell, :info,
+ ["config :pleroma, :instance, [name: \"Pleroma Test\"]\r\n\r\n"]}
+ end
+
+ test "dumping a specific key in a group" do
+ insert_config_record(:pleroma, :instance, name: "Pleroma Test")
+ insert_config_record(:pleroma, Pleroma.Captcha, enabled: false)
+
+ MixTask.run(["dump", "pleroma", "Pleroma.Captcha"])
+
+ refute_receive {:mix_shell, :info,
+ ["config :pleroma, :instance, [name: \"Pleroma Test\"]\r\n\r\n"]}
+
+ assert_receive {:mix_shell, :info,
+ ["config :pleroma, Pleroma.Captcha, [enabled: false]\r\n\r\n"]}
+ end
+
+ test "dumps all configuration successfully" do
+ insert_config_record(:pleroma, :instance, name: "Pleroma Test")
+ insert_config_record(:pleroma, Pleroma.Captcha, enabled: false)
+
+ MixTask.run(["dump"])
+
+ assert_receive {:mix_shell, :info,
+ ["config :pleroma, :instance, [name: \"Pleroma Test\"]\r\n\r\n"]}
+
+ assert_receive {:mix_shell, :info,
+ ["config :pleroma, Pleroma.Captcha, [enabled: false]\r\n\r\n"]}
+ end
+ end
+
+ describe "when configdb disabled" do
+ test "refuses to dump" do
+ clear_config(:configurable_from_database, false)
+
+ insert_config_record(:pleroma, :instance, name: "Pleroma Test")
+
+ MixTask.run(["dump"])
+
+ msg =
+ "ConfigDB not enabled. Please check the value of :configurable_from_database in your configuration."
+
+ assert_receive {:mix_shell, :error, [^msg]}
+ end
+ end
+
+ describe "destructive operations" do
+ setup do: clear_config(:configurable_from_database, true)
+
+ setup do
+ insert_config_record(:pleroma, :instance, name: "Pleroma Test")
+ insert_config_record(:pleroma, Pleroma.Captcha, enabled: false)
+ insert_config_record(:pleroma2, :key2, z: 1)
+
+ assert length(config_records()) == 3
+
+ :ok
+ end
+
+ test "deletes group of settings" do
+ MixTask.run(["delete", "--force", "pleroma"])
+
+ assert [%ConfigDB{group: :pleroma2, key: :key2}] = config_records()
+ end
+
+ test "deletes specified key" do
+ MixTask.run(["delete", "--force", "pleroma", "Pleroma.Captcha"])
+
+ assert [
+ %ConfigDB{group: :pleroma, key: :instance},
+ %ConfigDB{group: :pleroma2, key: :key2}
+ ] = config_records()
+ end
+
+ test "resets entire config" do
+ MixTask.run(["reset", "--force"])
+
+ assert config_records() == []
+ end
+ end
end
diff --git a/test/mix/tasks/pleroma/count_statuses_test.exs b/test/mix/tasks/pleroma/count_statuses_test.exs
index c5cd16960..8fe3959ea 100644
--- a/test/mix/tasks/pleroma/count_statuses_test.exs
+++ b/test/mix/tasks/pleroma/count_statuses_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.CountStatusesTest do
+ # Uses log capture, has to stay synchronous
use Pleroma.DataCase
alias Pleroma.User
diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs
index 292a5ef5f..eefb12426 100644
--- a/test/mix/tasks/pleroma/database_test.exs
+++ b/test/mix/tasks/pleroma/database_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.DatabaseTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
use Oban.Testing, repo: Pleroma.Repo
alias Pleroma.Activity
@@ -73,7 +73,7 @@ test "it prunes old objects from the database" do
describe "running update_users_following_followers_counts" do
test "following and followers count are updated" do
[user, user2] = insert_pair(:user)
- {:ok, %User{} = user} = User.follow(user, user2)
+ {:ok, %User{} = user, _user2} = User.follow(user, user2)
following = User.following(user)
@@ -87,7 +87,8 @@ test "following and followers count are updated" do
assert user.follower_count == 3
- assert :ok == Mix.Tasks.Pleroma.Database.run(["update_users_following_followers_counts"])
+ assert {:ok, :ok} ==
+ Mix.Tasks.Pleroma.Database.run(["update_users_following_followers_counts"])
user = User.get_by_id(user.id)
diff --git a/test/mix/tasks/pleroma/ecto/migrate_test.exs b/test/mix/tasks/pleroma/ecto/migrate_test.exs
index 43df176a1..548357508 100644
--- a/test/mix/tasks/pleroma/ecto/migrate_test.exs
+++ b/test/mix/tasks/pleroma/ecto/migrate_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-onl
defmodule Mix.Tasks.Pleroma.Ecto.MigrateTest do
- use Pleroma.DataCase, async: true
+ use Pleroma.DataCase
import ExUnit.CaptureLog
require Logger
diff --git a/test/mix/tasks/pleroma/ecto/rollback_test.exs b/test/mix/tasks/pleroma/ecto/rollback_test.exs
index 0236e35d5..9e39db8fa 100644
--- a/test/mix/tasks/pleroma/ecto/rollback_test.exs
+++ b/test/mix/tasks/pleroma/ecto/rollback_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.Ecto.RollbackTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import ExUnit.CaptureLog
require Logger
diff --git a/test/mix/tasks/pleroma/instance_test.exs b/test/mix/tasks/pleroma/instance_test.exs
index fe69a2def..1d2dde108 100644
--- a/test/mix/tasks/pleroma/instance_test.exs
+++ b/test/mix/tasks/pleroma/instance_test.exs
@@ -3,9 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.InstanceTest do
- use ExUnit.Case
-
- @release_env_file "./test/pleroma.test.env"
+ # Modifies the Application Environment, has to stay synchronous.
+ use Pleroma.DataCase
setup do
File.mkdir_p!(tmp_path())
@@ -17,17 +16,17 @@ defmodule Mix.Tasks.Pleroma.InstanceTest do
if File.exists?(static_dir) do
File.rm_rf(Path.join(static_dir, "robots.txt"))
end
-
- if File.exists?(@release_env_file), do: File.rm_rf(@release_env_file)
-
- Pleroma.Config.put([:instance, :static_dir], static_dir)
end)
+ # Is being modified by the mix task.
+ clear_config([:instance, :static_dir])
+
:ok
end
+ @uuid Ecto.UUID.generate()
defp tmp_path do
- "/tmp/generated_files/"
+ "/tmp/generated_files/#{@uuid}/"
end
test "running gen" do
@@ -73,9 +72,7 @@ test "running gen" do
"--dedupe-uploads",
"n",
"--anonymize-uploads",
- "n",
- "--release-env-file",
- @release_env_file
+ "n"
])
end
@@ -94,12 +91,9 @@ test "running gen" do
assert generated_config =~ "password: \"dbpass\""
assert generated_config =~ "configurable_from_database: true"
assert generated_config =~ "http: [ip: {127, 0, 0, 1}, port: 4000]"
- assert generated_config =~ "filters: [Pleroma.Upload.Filter.ExifTool]"
+ assert generated_config =~ "filters: [Pleroma.Upload.Filter.Exiftool]"
assert File.read!(tmp_path() <> "setup.psql") == generated_setup_psql()
assert File.exists?(Path.expand("./test/instance/static/robots.txt"))
- assert File.exists?(@release_env_file)
-
- assert File.read!(@release_env_file) =~ ~r/^RELEASE_COOKIE=.*/
end
defp generated_setup_psql do
diff --git a/test/mix/tasks/pleroma/refresh_counter_cache_test.exs b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs
index 6a1a9ac17..e79dc0632 100644
--- a/test/mix/tasks/pleroma/refresh_counter_cache_test.exs
+++ b/test/mix/tasks/pleroma/refresh_counter_cache_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Mix.Tasks.Pleroma.RefreshCounterCacheTest do
+ # Uses log capture, has to stay synchronous
use Pleroma.DataCase
alias Pleroma.Web.CommonAPI
import ExUnit.CaptureIO, only: [capture_io: 1]
diff --git a/test/mix/tasks/pleroma/relay_test.exs b/test/mix/tasks/pleroma/relay_test.exs
index cf48e7dda..b453ed1c6 100644
--- a/test/mix/tasks/pleroma/relay_test.exs
+++ b/test/mix/tasks/pleroma/relay_test.exs
@@ -100,7 +100,7 @@ test "unfollow when relay is dead" do
end)
Pleroma.Repo.delete(user)
- Cachex.clear(:user_cache)
+ User.invalidate_cache(user)
Mix.Tasks.Pleroma.Relay.run(["unfollow", target_instance])
@@ -137,7 +137,7 @@ test "force unfollow when relay is dead" do
end)
Pleroma.Repo.delete(user)
- Cachex.clear(:user_cache)
+ User.invalidate_cache(user)
Mix.Tasks.Pleroma.Relay.run(["unfollow", target_instance, "--force"])
diff --git a/test/mix/tasks/pleroma/release_env_test.exs b/test/mix/tasks/pleroma/release_env_test.exs
deleted file mode 100644
index 519f1eba9..000000000
--- a/test/mix/tasks/pleroma/release_env_test.exs
+++ /dev/null
@@ -1,30 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Mix.Tasks.Pleroma.ReleaseEnvTest do
- use ExUnit.Case
- import ExUnit.CaptureIO, only: [capture_io: 1]
-
- @path "config/pleroma.test.env"
-
- def do_clean do
- if File.exists?(@path) do
- File.rm_rf(@path)
- end
- end
-
- setup do
- do_clean()
- on_exit(fn -> do_clean() end)
- :ok
- end
-
- test "generate pleroma.env" do
- assert capture_io(fn ->
- Mix.Tasks.Pleroma.ReleaseEnv.run(["gen", "--path", @path, "--force"])
- end) =~ "The file generated"
-
- assert File.read!(@path) =~ "RELEASE_COOKIE="
- end
-end
diff --git a/test/mix/tasks/pleroma/user_test.exs b/test/mix/tasks/pleroma/user_test.exs
index ce819f815..de8ab27e5 100644
--- a/test/mix/tasks/pleroma/user_test.exs
+++ b/test/mix/tasks/pleroma/user_test.exs
@@ -36,7 +36,7 @@ test "user is created" do
unsaved = build(:user)
# prepare to answer yes
- send(self(), {:mix_shell_input, :yes?, true})
+ send(self(), {:mix_shell_input, :prompt, "Y"})
Mix.Tasks.Pleroma.User.run([
"new",
@@ -55,7 +55,7 @@ test "user is created" do
assert_received {:mix_shell, :info, [message]}
assert message =~ "user will be created"
- assert_received {:mix_shell, :yes?, [message]}
+ assert_received {:mix_shell, :prompt, [message]}
assert message =~ "Continue"
assert_received {:mix_shell, :info, [message]}
@@ -73,14 +73,14 @@ test "user is not created" do
unsaved = build(:user)
# prepare to answer no
- send(self(), {:mix_shell_input, :yes?, false})
+ send(self(), {:mix_shell_input, :prompt, "N"})
Mix.Tasks.Pleroma.User.run(["new", unsaved.nickname, unsaved.email])
assert_received {:mix_shell, :info, [message]}
assert message =~ "user will be created"
- assert_received {:mix_shell, :yes?, [message]}
+ assert_received {:mix_shell, :prompt, [message]}
assert message =~ "Continue"
assert_received {:mix_shell, :info, [message]}
@@ -462,24 +462,24 @@ test "it prints an error message when user is not exist" do
end
end
- describe "running toggle_confirmed" do
+ describe "running confirm" do
test "user is confirmed" do
%{id: id, nickname: nickname} = insert(:user, confirmation_pending: false)
- assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
+ assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
assert_received {:mix_shell, :info, [message]}
- assert message == "#{nickname} needs confirmation."
+ assert message == "#{nickname} doesn't need confirmation."
user = Repo.get(User, id)
- assert user.confirmation_pending
- assert user.confirmation_token
+ refute user.confirmation_pending
+ refute user.confirmation_token
end
test "user is not confirmed" do
%{id: id, nickname: nickname} =
insert(:user, confirmation_pending: true, confirmation_token: "some token")
- assert :ok = Mix.Tasks.Pleroma.User.run(["toggle_confirmed", nickname])
+ assert :ok = Mix.Tasks.Pleroma.User.run(["confirm", nickname])
assert_received {:mix_shell, :info, [message]}
assert message == "#{nickname} doesn't need confirmation."
@@ -489,7 +489,7 @@ test "user is not confirmed" do
end
test "it prints an error message when user is not exist" do
- Mix.Tasks.Pleroma.User.run(["toggle_confirmed", "foo"])
+ Mix.Tasks.Pleroma.User.run(["confirm", "foo"])
assert_received {:mix_shell, :error, [message]}
assert message =~ "No local user"
@@ -503,7 +503,7 @@ test "it returns users matching" do
moot = insert(:user, nickname: "moot")
kawen = insert(:user, nickname: "kawen", name: "fediverse expert moon")
- {:ok, user} = User.follow(user, moon)
+ {:ok, user, moon} = User.follow(user, moon)
assert [moon.id, kawen.id] == User.Search.search("moon") |> Enum.map(& &1.id)
diff --git a/test/pleroma/activity/ir/topics_test.exs b/test/pleroma/activity/ir/topics_test.exs
index 5e5c2f8da..b464822d9 100644
--- a/test/pleroma/activity/ir/topics_test.exs
+++ b/test/pleroma/activity/ir/topics_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Activity.Ir.TopicsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Activity.Ir.Topics
diff --git a/test/pleroma/activity/search_test.exs b/test/pleroma/activity/search_test.exs
new file mode 100644
index 000000000..49b7aa292
--- /dev/null
+++ b/test/pleroma/activity/search_test.exs
@@ -0,0 +1,45 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Activity.SearchTest do
+ alias Pleroma.Activity.Search
+ alias Pleroma.Web.CommonAPI
+ import Pleroma.Factory
+
+ use Pleroma.DataCase, async: true
+
+ test "it finds something" do
+ user = insert(:user)
+ {:ok, post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
+
+ [result] = Search.search(nil, "wednesday")
+
+ assert result.id == post.id
+ end
+
+ test "using plainto_tsquery on postgres < 11" do
+ old_version = :persistent_term.get({Pleroma.Repo, :postgres_version})
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, 10.0)
+ on_exit(fn -> :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version) end)
+
+ user = insert(:user)
+ {:ok, post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
+ {:ok, _post2} = CommonAPI.post(user, %{status: "it's wednesday my bros"})
+
+ # plainto doesn't understand complex queries
+ assert [result] = Search.search(nil, "wednesday -dudes")
+
+ assert result.id == post.id
+ end
+
+ test "using websearch_to_tsquery" do
+ user = insert(:user)
+ {:ok, _post} = CommonAPI.post(user, %{status: "it's wednesday my dudes"})
+ {:ok, other_post} = CommonAPI.post(user, %{status: "it's wednesday my bros"})
+
+ assert [result] = Search.search(nil, "wednesday -dudes")
+
+ assert result.id == other_post.id
+ end
+end
diff --git a/test/pleroma/activity_test.exs b/test/pleroma/activity_test.exs
index ee6a99cc3..105f9f766 100644
--- a/test/pleroma/activity_test.exs
+++ b/test/pleroma/activity_test.exs
@@ -197,6 +197,13 @@ test "all_by_ids_with_object/1" do
assert [%{id: ^id1, object: %Object{}}, %{id: ^id2, object: %Object{}}] = activities
end
+ test "get_by_id_with_user_actor/1" do
+ user = insert(:user)
+ activity = insert(:note_activity, note: insert(:note, user: user))
+
+ assert Activity.get_by_id_with_user_actor(activity.id).user_actor == user
+ end
+
test "get_by_id_with_object/1" do
%{id: id} = insert(:note_activity)
@@ -231,4 +238,20 @@ test "all_by_actor_and_id/2" do
assert [%Activity{id: ^id1}, %Activity{id: ^id2}] = activities
end
+
+ test "get_by_object_ap_id_with_object/1" do
+ user = insert(:user)
+ another = insert(:user)
+
+ {:ok, %{id: id, object: %{data: %{"id" => obj_id}}}} =
+ Pleroma.Web.CommonAPI.post(user, %{status: "cofe"})
+
+ Pleroma.Web.CommonAPI.favorite(another, id)
+
+ assert obj_id
+ |> Pleroma.Activity.Queries.by_object_id()
+ |> Repo.aggregate(:count, :id) == 2
+
+ assert %{id: ^id} = Activity.get_by_object_ap_id_with_object(obj_id)
+ end
end
diff --git a/test/pleroma/application_requirements_test.exs b/test/pleroma/application_requirements_test.exs
index c505ae229..e3cca5487 100644
--- a/test/pleroma/application_requirements_test.exs
+++ b/test/pleroma/application_requirements_test.exs
@@ -12,6 +12,26 @@ defmodule Pleroma.ApplicationRequirementsTest do
alias Pleroma.Config
alias Pleroma.Repo
+ describe "check_repo_pool_size!/1" do
+ test "raises if the pool size is unexpected" do
+ clear_config([Pleroma.Repo, :pool_size], 11)
+ clear_config([:dangerzone, :override_repo_pool_size], false)
+
+ assert_raise Pleroma.ApplicationRequirements.VerifyError,
+ "Repo.pool_size different than recommended value.",
+ fn ->
+ capture_log(&Pleroma.ApplicationRequirements.verify!/0)
+ end
+ end
+
+ test "doesn't raise if the pool size is unexpected but the respective flag is set" do
+ clear_config([Pleroma.Repo, :pool_size], 11)
+ clear_config([:dangerzone, :override_repo_pool_size], true)
+
+ assert Pleroma.ApplicationRequirements.verify!() == :ok
+ end
+ end
+
describe "check_welcome_message_config!/1" do
setup do: clear_config([:welcome])
setup do: clear_config([Pleroma.Emails.Mailer])
diff --git a/test/pleroma/bbs/handler_test.exs b/test/pleroma/bbs/handler_test.exs
index eb716486e..bba8fab0f 100644
--- a/test/pleroma/bbs/handler_test.exs
+++ b/test/pleroma/bbs/handler_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.BBS.HandlerTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.BBS.Handler
alias Pleroma.Object
@@ -19,7 +19,7 @@ test "getting the home timeline" do
user = insert(:user)
followed = insert(:user)
- {:ok, user} = User.follow(user, followed)
+ {:ok, user, followed} = User.follow(user, followed)
{:ok, _first} = CommonAPI.post(user, %{status: "hey"})
{:ok, _second} = CommonAPI.post(followed, %{status: "hello"})
diff --git a/test/pleroma/bookmark_test.exs b/test/pleroma/bookmark_test.exs
index 2726fe7cd..ef090d785 100644
--- a/test/pleroma/bookmark_test.exs
+++ b/test/pleroma/bookmark_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.BookmarkTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Bookmark
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/captcha_test.exs b/test/pleroma/captcha_test.exs
index 1b9f4a12f..bde3c72f7 100644
--- a/test/pleroma/captcha_test.exs
+++ b/test/pleroma/captcha_test.exs
@@ -80,7 +80,6 @@ test "validate" do
assert is_binary(answer)
assert :ok = Captcha.validate(token, "63615261b77f5354fb8c4e4986477555", answer)
- Cachex.del(:used_captcha_cache, token)
end
test "doesn't validate invalid answer" do
diff --git a/test/pleroma/chat_test.exs b/test/pleroma/chat_test.exs
index 9e8a9ebf0..1dd04916c 100644
--- a/test/pleroma/chat_test.exs
+++ b/test/pleroma/chat_test.exs
@@ -73,7 +73,8 @@ test "a returning chat will have an updated `update_at` field" do
other_user = insert(:user)
{:ok, chat} = Chat.bump_or_create(user.id, other_user.ap_id)
- :timer.sleep(1500)
+ {:ok, chat} = time_travel(chat, -2)
+
{:ok, chat_two} = Chat.bump_or_create(user.id, other_user.ap_id)
assert chat.id == chat_two.id
diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs
index 0cfed4555..f52629f8a 100644
--- a/test/pleroma/config/deprecation_warnings_test.exs
+++ b/test/pleroma/config/deprecation_warnings_test.exs
@@ -12,7 +12,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
alias Pleroma.Config.DeprecationWarnings
test "check_old_mrf_config/0" do
- clear_config([:instance, :rewrite_policy], Pleroma.Web.ActivityPub.MRF.NoOpPolicy)
+ clear_config([:instance, :rewrite_policy], [])
clear_config([:instance, :mrf_transparency], true)
clear_config([:instance, :mrf_transparency_exclusions], [])
diff --git a/test/pleroma/config_test.exs b/test/pleroma/config_test.exs
index 1556e4237..f524d90dd 100644
--- a/test/pleroma/config_test.exs
+++ b/test/pleroma/config_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ConfigTest do
- use ExUnit.Case
+ use Pleroma.DataCase
test "get/1 with an atom" do
assert Pleroma.Config.get(:instance) == Application.get_env(:pleroma, :instance)
diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs
index 5a603dcc1..122b10486 100644
--- a/test/pleroma/conversation/participation_test.exs
+++ b/test/pleroma/conversation/participation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Conversation.ParticipationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Conversation
alias Pleroma.Conversation.Participation
@@ -96,12 +96,11 @@ test "it creates a participation for a conversation and a user" do
{:ok, %Participation{} = participation} =
Participation.create_for_user_and_conversation(user, conversation)
+ {:ok, participation} = time_travel(participation, -2)
+
assert participation.user_id == user.id
assert participation.conversation_id == conversation.id
- # Needed because updated_at is accurate down to a second
- :timer.sleep(1000)
-
# Creating again returns the same participation
{:ok, %Participation{} = participation_two} =
Participation.create_for_user_and_conversation(user, conversation)
diff --git a/test/pleroma/earmark_renderer_test.exs b/test/pleroma/earmark_renderer_test.exs
index 220d97d16..73aaec7f4 100644
--- a/test/pleroma/earmark_renderer_test.exs
+++ b/test/pleroma/earmark_renderer_test.exs
@@ -2,7 +2,7 @@
# Copyright © 2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.EarmarkRendererTest do
- use ExUnit.Case
+ use Pleroma.DataCase, async: true
test "Paragraph" do
code = ~s[Hello\n\nWorld!]
diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs
index 812463454..a8471e2e3 100644
--- a/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs
+++ b/test/pleroma/ecto_type/activity_pub/object_validators/date_time_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.DateTimeTest do
alias Pleroma.EctoType.ActivityPub.ObjectValidators.DateTime
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
test "it validates an xsd:Datetime" do
valid_strings = [
diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs
index 732e2365f..3b6006854 100644
--- a/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs
+++ b/test/pleroma/ecto_type/activity_pub/object_validators/object_id_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectIDTest do
alias Pleroma.EctoType.ActivityPub.ObjectValidators.ObjectID
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
@uris [
"http://lain.com/users/lain",
diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs
index 2e6a0c83d..b7eb59ab0 100644
--- a/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs
+++ b/test/pleroma/ecto_type/activity_pub/object_validators/recipients_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.RecipientsTest do
alias Pleroma.EctoType.ActivityPub.ObjectValidators.Recipients
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
test "it asserts that all elements of the list are object ids" do
list = ["https://lain.com/users/lain", "invalid"]
diff --git a/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs
index 7eddd2388..154363f68 100644
--- a/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs
+++ b/test/pleroma/ecto_type/activity_pub/object_validators/safe_text_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.EctoType.ActivityPub.ObjectValidators.SafeTextTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.EctoType.ActivityPub.ObjectValidators.SafeText
diff --git a/test/pleroma/emails/admin_email_test.exs b/test/pleroma/emails/admin_email_test.exs
index 155057f3e..9aaf7b04f 100644
--- a/test/pleroma/emails/admin_email_test.exs
+++ b/test/pleroma/emails/admin_email_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emails.AdminEmailTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Emails.AdminEmail
@@ -19,8 +19,8 @@ test "build report email" do
AdminEmail.report(to_user, reporter, account, [%{name: "Test", id: "12"}], "Test comment")
status_url = Helpers.o_status_url(Pleroma.Web.Endpoint, :notice, "12")
- reporter_url = Helpers.user_feed_url(Pleroma.Web.Endpoint, :feed_redirect, reporter.id)
- account_url = Helpers.user_feed_url(Pleroma.Web.Endpoint, :feed_redirect, account.id)
+ reporter_url = reporter.ap_id
+ account_url = account.ap_id
assert res.to == [{to_user.name, to_user.email}]
assert res.from == {config[:name], config[:notify_email]}
@@ -54,7 +54,7 @@ test "new unapproved registration email" do
res = AdminEmail.new_unapproved_registration(to_user, account)
- account_url = Helpers.user_feed_url(Pleroma.Web.Endpoint, :feed_redirect, account.id)
+ account_url = account.ap_id
assert res.to == [{to_user.name, to_user.email}]
assert res.from == {config[:name], config[:notify_email]}
diff --git a/test/pleroma/emails/user_email_test.exs b/test/pleroma/emails/user_email_test.exs
index a75623bb4..bd21d8dec 100644
--- a/test/pleroma/emails/user_email_test.exs
+++ b/test/pleroma/emails/user_email_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emails.UserEmailTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Emails.UserEmail
alias Pleroma.Web.Endpoint
@@ -45,4 +45,15 @@ test "build account confirmation email" do
assert email.html_body =~
Router.Helpers.confirm_email_url(Endpoint, :confirm_email, user.id, "conf-token")
end
+
+ test "build approval pending email" do
+ config = Pleroma.Config.get(:instance)
+ user = insert(:user)
+ email = UserEmail.approval_pending_email(user)
+
+ assert email.from == {config[:name], config[:notify_email]}
+ assert email.to == [{user.name, user.email}]
+ assert email.subject == "Your account is awaiting approval"
+ assert email.html_body =~ "Awaiting Approval"
+ end
end
diff --git a/test/pleroma/emoji/formatter_test.exs b/test/pleroma/emoji/formatter_test.exs
index 12af6cd8b..096d23ca6 100644
--- a/test/pleroma/emoji/formatter_test.exs
+++ b/test/pleroma/emoji/formatter_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.Emoji.FormatterTest do
alias Pleroma.Emoji.Formatter
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
describe "emojify" do
test "it adds cool emoji" do
diff --git a/test/pleroma/emoji/pack_test.exs b/test/pleroma/emoji/pack_test.exs
index 70d1eaa1b..158dfee06 100644
--- a/test/pleroma/emoji/pack_test.exs
+++ b/test/pleroma/emoji/pack_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Emoji.PackTest do
- use ExUnit.Case, async: true
+ use Pleroma.DataCase
alias Pleroma.Emoji.Pack
@emoji_path Path.join(
diff --git a/test/pleroma/emoji_test.exs b/test/pleroma/emoji_test.exs
index 1dd3c58c6..c99c9ef4c 100644
--- a/test/pleroma/emoji_test.exs
+++ b/test/pleroma/emoji_test.exs
@@ -3,14 +3,28 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.EmojiTest do
- use ExUnit.Case
+ use ExUnit.Case, async: true
alias Pleroma.Emoji
describe "is_unicode_emoji?/1" do
test "tells if a string is an unicode emoji" do
refute Emoji.is_unicode_emoji?("X")
- assert Emoji.is_unicode_emoji?("☂")
+ refute Emoji.is_unicode_emoji?("ね")
+
+ # Only accept fully-qualified (RGI) emoji
+ # See http://www.unicode.org/reports/tr51/
+ refute Emoji.is_unicode_emoji?("❤")
+ refute Emoji.is_unicode_emoji?("☂")
+
assert Emoji.is_unicode_emoji?("🥺")
+ assert Emoji.is_unicode_emoji?("🤰")
+ assert Emoji.is_unicode_emoji?("❤️")
+ assert Emoji.is_unicode_emoji?("🏳️⚧️")
+
+ # Additionally, we accept regional indicators.
+ assert Emoji.is_unicode_emoji?("🇵")
+ assert Emoji.is_unicode_emoji?("🇴")
+ assert Emoji.is_unicode_emoji?("🇬")
end
end
diff --git a/test/pleroma/filter_test.exs b/test/pleroma/filter_test.exs
index 0a5c4426a..da9515902 100644
--- a/test/pleroma/filter_test.exs
+++ b/test/pleroma/filter_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.FilterTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/following_relationship_test.exs b/test/pleroma/following_relationship_test.exs
index 17a468abb..f0d2c3846 100644
--- a/test/pleroma/following_relationship_test.exs
+++ b/test/pleroma/following_relationship_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.FollowingRelationshipTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.FollowingRelationship
alias Pleroma.Web.ActivityPub.InternalFetchActor
diff --git a/test/pleroma/formatter_test.exs b/test/pleroma/formatter_test.exs
index f066bd50a..5781a3f01 100644
--- a/test/pleroma/formatter_test.exs
+++ b/test/pleroma/formatter_test.exs
@@ -241,16 +241,14 @@ test "it can parse mentions and return the relevant users" do
"@@gsimg According to @archaeme, that is @daggsy. Also hello @archaeme@archae.me and @o and @@@jimm"
o = insert(:user, %{nickname: "o"})
- jimm = insert(:user, %{nickname: "jimm"})
- gsimg = insert(:user, %{nickname: "gsimg"})
+ _jimm = insert(:user, %{nickname: "jimm"})
+ _gsimg = insert(:user, %{nickname: "gsimg"})
archaeme = insert(:user, %{nickname: "archaeme"})
archaeme_remote = insert(:user, %{nickname: "archaeme@archae.me"})
expected_mentions = [
{"@archaeme", archaeme},
{"@archaeme@archae.me", archaeme_remote},
- {"@gsimg", gsimg},
- {"@jimm", jimm},
{"@o", o}
]
diff --git a/test/pleroma/frontend_test.exs b/test/pleroma/frontend_test.exs
new file mode 100644
index 000000000..223625857
--- /dev/null
+++ b/test/pleroma/frontend_test.exs
@@ -0,0 +1,72 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.FrontendTest do
+ use Pleroma.DataCase
+ alias Pleroma.Frontend
+
+ @dir "test/frontend_static_test"
+
+ setup do
+ File.mkdir_p!(@dir)
+ clear_config([:instance, :static_dir], @dir)
+
+ on_exit(fn ->
+ File.rm_rf(@dir)
+ end)
+ end
+
+ test "it downloads and unzips a known frontend" do
+ clear_config([:frontends, :available], %{
+ "pleroma" => %{
+ "ref" => "fantasy",
+ "name" => "pleroma",
+ "build_url" => "http://gensokyo.2hu/builds/${ref}"
+ }
+ })
+
+ Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/builds/fantasy"} ->
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend_dist.zip")}
+ end)
+
+ Frontend.install("pleroma")
+
+ assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
+ end
+
+ test "it also works given a file" do
+ clear_config([:frontends, :available], %{
+ "pleroma" => %{
+ "ref" => "fantasy",
+ "name" => "pleroma",
+ "build_dir" => ""
+ }
+ })
+
+ folder = Path.join([@dir, "frontends", "pleroma", "fantasy"])
+ previously_existing = Path.join([folder, "temp"])
+ File.mkdir_p!(folder)
+ File.write!(previously_existing, "yey")
+ assert File.exists?(previously_existing)
+
+ Frontend.install("pleroma", file: "test/fixtures/tesla_mock/frontend.zip")
+
+ assert File.exists?(Path.join([folder, "test.txt"]))
+ refute File.exists?(previously_existing)
+ end
+
+ test "it downloads and unzips unknown frontends" do
+ Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/madeup.zip"} ->
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
+ end)
+
+ Frontend.install("unknown",
+ ref: "baka",
+ build_url: "http://gensokyo.2hu/madeup.zip",
+ build_dir: ""
+ )
+
+ assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"]))
+ end
+end
diff --git a/test/pleroma/healthcheck_test.exs b/test/pleroma/healthcheck_test.exs
index e341e6983..a1bc25d25 100644
--- a/test/pleroma/healthcheck_test.exs
+++ b/test/pleroma/healthcheck_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HealthcheckTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Healthcheck
test "system_info/0" do
diff --git a/test/pleroma/html_test.exs b/test/pleroma/html_test.exs
index 7d3756884..9737f2458 100644
--- a/test/pleroma/html_test.exs
+++ b/test/pleroma/html_test.exs
@@ -6,7 +6,7 @@ defmodule Pleroma.HTMLTest do
alias Pleroma.HTML
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/http/adapter_helper/gun_test.exs b/test/pleroma/http/adapter_helper/gun_test.exs
index 80589c73d..487d2e7c1 100644
--- a/test/pleroma/http/adapter_helper/gun_test.exs
+++ b/test/pleroma/http/adapter_helper/gun_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.HTTP.AdapterHelper.GunTest do
- use ExUnit.Case, async: true
+ use ExUnit.Case
use Pleroma.Tests.Helpers
import Mox
diff --git a/test/pleroma/instances/instance_test.exs b/test/pleroma/instances/instance_test.exs
index 4f0805100..2c6389e4f 100644
--- a/test/pleroma/instances/instance_test.exs
+++ b/test/pleroma/instances/instance_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Instances.InstanceTest do
+ alias Pleroma.Instances
alias Pleroma.Instances.Instance
alias Pleroma.Repo
@@ -148,5 +149,13 @@ test "Handles not getting a favicon URL properly" do
)
end) =~ "Instance.scrape_favicon(\"https://no-favicon.example.org/\") error: "
end
+
+ test "Doesn't scrapes unreachable instances" do
+ instance = insert(:instance, unreachable_since: Instances.reachability_datetime_threshold())
+ url = "https://" <> instance.host
+
+ assert capture_log(fn -> assert nil == Instance.get_or_update_favicon(URI.parse(url)) end) =~
+ "Instance.scrape_favicon(\"#{url}\") ignored unreachable host"
+ end
end
end
diff --git a/test/pleroma/instances_test.exs b/test/pleroma/instances_test.exs
index d2618025c..5d0ce6237 100644
--- a/test/pleroma/instances_test.exs
+++ b/test/pleroma/instances_test.exs
@@ -32,9 +32,9 @@ test "returns `true` for host / url marked unreachable for less than `reachabili
assert Instances.reachable?(URI.parse(url).host)
end
- test "returns true on non-binary input" do
- assert Instances.reachable?(nil)
- assert Instances.reachable?(1)
+ test "raises FunctionClauseError exception on non-binary input" do
+ assert_raise FunctionClauseError, fn -> Instances.reachable?(nil) end
+ assert_raise FunctionClauseError, fn -> Instances.reachable?(1) end
end
end
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs
index bb8e795b7..4a7dbda71 100644
--- a/test/pleroma/integration/mastodon_websocket_test.exs
+++ b/test/pleroma/integration/mastodon_websocket_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Integration.MastodonWebsocketTest do
+ # Needs a streamer, needs to stay synchronous
use Pleroma.DataCase
import ExUnit.CaptureLog
diff --git a/test/pleroma/keys_test.exs b/test/pleroma/keys_test.exs
index 9e8528cba..55a7aa1bc 100644
--- a/test/pleroma/keys_test.exs
+++ b/test/pleroma/keys_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.KeysTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Keys
diff --git a/test/pleroma/list_test.exs b/test/pleroma/list_test.exs
index b5572cbae..854e276f1 100644
--- a/test/pleroma/list_test.exs
+++ b/test/pleroma/list_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.ListTest do
alias Pleroma.Repo
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/marker_test.exs b/test/pleroma/marker_test.exs
index 7b3943c7b..3055f1ce2 100644
--- a/test/pleroma/marker_test.exs
+++ b/test/pleroma/marker_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MarkerTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Marker
import Pleroma.Factory
diff --git a/test/pleroma/mfa/backup_codes_test.exs b/test/pleroma/mfa/backup_codes_test.exs
index 41adb1e96..c3eaf40b6 100644
--- a/test/pleroma/mfa/backup_codes_test.exs
+++ b/test/pleroma/mfa/backup_codes_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MFA.BackupCodesTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.MFA.BackupCodes
diff --git a/test/pleroma/mfa/totp_test.exs b/test/pleroma/mfa/totp_test.exs
index 9edb6fd54..8c09bf447 100644
--- a/test/pleroma/mfa/totp_test.exs
+++ b/test/pleroma/mfa/totp_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MFA.TOTPTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.MFA.TOTP
diff --git a/test/pleroma/mfa_test.exs b/test/pleroma/mfa_test.exs
index 8875cefd9..cd1f7d0af 100644
--- a/test/pleroma/mfa_test.exs
+++ b/test/pleroma/mfa_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MFATest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.MFA
diff --git a/test/pleroma/migration_helper/notification_backfill_test.exs b/test/pleroma/migration_helper/notification_backfill_test.exs
index 2a62a2b00..6fe8a11ac 100644
--- a/test/pleroma/migration_helper/notification_backfill_test.exs
+++ b/test/pleroma/migration_helper/notification_backfill_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.MigrationHelper.NotificationBackfillTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.MigrationHelper.NotificationBackfill
diff --git a/test/pleroma/moderation_log_test.exs b/test/pleroma/moderation_log_test.exs
index 59f4d67f8..d1e0e1e6b 100644
--- a/test/pleroma/moderation_log_test.exs
+++ b/test/pleroma/moderation_log_test.exs
@@ -6,7 +6,7 @@ defmodule Pleroma.ModerationLogTest do
alias Pleroma.Activity
alias Pleroma.ModerationLog
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
@@ -182,11 +182,14 @@ test "logging relay unfollow", %{moderator: moderator} do
end
test "logging report update", %{moderator: moderator} do
+ user = insert(:user)
+
report = %Activity{
id: "9m9I1F4p8ftrTP6QTI",
data: %{
"type" => "Flag",
- "state" => "resolved"
+ "state" => "resolved",
+ "actor" => user.ap_id
}
}
@@ -194,35 +197,48 @@ test "logging report update", %{moderator: moderator} do
ModerationLog.insert_log(%{
actor: moderator,
action: "report_update",
- subject: report
+ subject: report,
+ subject_actor: user
})
log = Repo.one(ModerationLog)
assert log.data["message"] ==
- "@#{moderator.nickname} updated report ##{report.id} with 'resolved' state"
+ "@#{moderator.nickname} updated report ##{report.id} (on user @#{user.nickname}) with 'resolved' state"
end
test "logging report response", %{moderator: moderator} do
+ user = insert(:user)
+
report = %Activity{
id: "9m9I1F4p8ftrTP6QTI",
data: %{
- "type" => "Note"
+ "type" => "Note",
+ "actor" => user.ap_id
}
}
- {:ok, _} =
- ModerationLog.insert_log(%{
- actor: moderator,
- action: "report_note",
- subject: report,
- text: "look at this"
- })
+ attrs = %{
+ actor: moderator,
+ action: "report_note",
+ subject: report,
+ text: "look at this"
+ }
- log = Repo.one(ModerationLog)
+ {:ok, log1} = ModerationLog.insert_log(attrs)
+ log = Repo.get(ModerationLog, log1.id)
assert log.data["message"] ==
"@#{moderator.nickname} added note 'look at this' to report ##{report.id}"
+
+ {:ok, log2} = ModerationLog.insert_log(Map.merge(attrs, %{subject_actor: user}))
+
+ log = Repo.get(ModerationLog, log2.id)
+
+ assert log.data["message"] ==
+ "@#{moderator.nickname} added note 'look at this' to report ##{report.id} on user @#{
+ user.nickname
+ }"
end
test "logging status sensitivity update", %{moderator: moderator} do
diff --git a/test/pleroma/notification_test.exs b/test/pleroma/notification_test.exs
index a74fb7bc2..a6558f995 100644
--- a/test/pleroma/notification_test.exs
+++ b/test/pleroma/notification_test.exs
@@ -32,6 +32,19 @@ test "never returns nil" do
refute {:ok, [nil]} == Notification.create_notifications(activity)
end
+ test "creates a notification for a report" do
+ reporting_user = insert(:user)
+ reported_user = insert(:user)
+ {:ok, moderator_user} = insert(:user) |> User.admin_api_update(%{is_moderator: true})
+
+ {:ok, activity} = CommonAPI.report(reporting_user, %{account_id: reported_user.id})
+
+ {:ok, [notification]} = Notification.create_notifications(activity)
+
+ assert notification.user_id == moderator_user.id
+ assert notification.type == "pleroma:report"
+ end
+
test "creates a notification for an emoji reaction" do
user = insert(:user)
other_user = insert(:user)
@@ -229,7 +242,7 @@ test "notification created if user is muted without notifications" do
muter = insert(:user)
muted = insert(:user)
- {:ok, _user_relationships} = User.mute(muter, muted, false)
+ {:ok, _user_relationships} = User.mute(muter, muted, %{notifications: false})
{:ok, activity} = CommonAPI.post(muted, %{status: "Hi @#{muter.nickname}"})
@@ -766,7 +779,7 @@ test "it returns following domain-blocking recipient in enabled recipients list"
other_user = insert(:user)
{:ok, other_user} = User.block_domain(other_user, blocked_domain)
- {:ok, other_user} = User.follow(other_user, user)
+ {:ok, other_user, user} = User.follow(other_user, user)
{:ok, activity} = CommonAPI.post(user, %{status: "hey @#{other_user.nickname}!"})
@@ -1015,7 +1028,7 @@ test "move activity generates a notification" do
test "it returns notifications for muted user without notifications", %{user: user} do
muted = insert(:user)
- {:ok, _user_relationships} = User.mute(user, muted, false)
+ {:ok, _user_relationships} = User.mute(user, muted, %{notifications: false})
{:ok, _activity} = CommonAPI.post(muted, %{status: "hey @#{user.nickname}"})
@@ -1057,7 +1070,7 @@ test "it returns notifications for domain-blocked but followed user" do
blocked = insert(:user, ap_id: "http://some-domain.com")
{:ok, user} = User.block_domain(user, "some-domain.com")
- {:ok, _} = User.follow(user, blocked)
+ {:ok, _, _} = User.follow(user, blocked)
{:ok, _activity} = CommonAPI.post(blocked, %{status: "hey @#{user.nickname}"})
diff --git a/test/pleroma/object/fetcher_test.exs b/test/pleroma/object/fetcher_test.exs
index 14d2c645f..7df6af7fe 100644
--- a/test/pleroma/object/fetcher_test.exs
+++ b/test/pleroma/object/fetcher_test.exs
@@ -21,6 +21,17 @@ defmodule Pleroma.Object.FetcherTest do
%{method: :get, url: "https://mastodon.example.org/users/userisgone404"} ->
%Tesla.Env{status: 404}
+ %{
+ method: :get,
+ url:
+ "https://patch.cx/media/03ca3c8b4ac3ddd08bf0f84be7885f2f88de0f709112131a22d83650819e36c2.json"
+ } ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/json"}],
+ body: File.read!("test/fixtures/spoofed-object.json")
+ }
+
env ->
apply(HttpRequestMock, :request, [env])
end)
@@ -34,19 +45,22 @@ defmodule Pleroma.Object.FetcherTest do
%{method: :get, url: "https://social.sakamoto.gq/notice/9wTkLEnuq47B25EehM"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/fetch_mocks/9wTkLEnuq47B25EehM.json")
+ body: File.read!("test/fixtures/fetch_mocks/9wTkLEnuq47B25EehM.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
%{method: :get, url: "https://social.sakamoto.gq/users/eal"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/fetch_mocks/eal.json")
+ body: File.read!("test/fixtures/fetch_mocks/eal.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
%{method: :get, url: "https://busshi.moe/users/tuxcrafting/statuses/104410921027210069"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/fetch_mocks/104410921027210069.json")
+ body: File.read!("test/fixtures/fetch_mocks/104410921027210069.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
%{method: :get, url: "https://busshi.moe/users/tuxcrafting"} ->
@@ -132,6 +146,13 @@ test "Return MRF reason when fetched status is rejected by one" do
"http://mastodon.example.org/@admin/99541947525187367"
)
end
+
+ test "it does not fetch a spoofed object uploaded on an instance as an attachment" do
+ assert {:error, _} =
+ Fetcher.fetch_object_from_id(
+ "https://patch.cx/media/03ca3c8b4ac3ddd08bf0f84be7885f2f88de0f709112131a22d83650819e36c2.json"
+ )
+ end
end
describe "implementation quirks" do
diff --git a/test/pleroma/object_test.exs b/test/pleroma/object_test.exs
index 99caba336..5d4e6fb84 100644
--- a/test/pleroma/object_test.exs
+++ b/test/pleroma/object_test.exs
@@ -281,7 +281,11 @@ test "does not fetch unknown objects when fetch_remote is false" do
setup do
mock(fn
%{method: :get, url: "https://patch.cx/objects/9a172665-2bc5-452d-8428-2361d4c33b1d"} ->
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/poll_original.json")}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/poll_original.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
+ }
env ->
apply(HttpRequestMock, :request, [env])
@@ -315,7 +319,8 @@ test "refetches if the time since the last refetch is greater than the interval"
mock_modified.(%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/poll_modified.json")
+ body: File.read!("test/fixtures/tesla_mock/poll_modified.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
})
updated_object = Object.get_by_id_and_maybe_refetch(object.id, interval: -1)
@@ -359,7 +364,8 @@ test "does not refetch if the time since the last refetch is greater than the in
mock_modified.(%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/poll_modified.json")
+ body: File.read!("test/fixtures/tesla_mock/poll_modified.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
})
updated_object = Object.get_by_id_and_maybe_refetch(object.id, interval: 100)
@@ -387,7 +393,8 @@ test "preserves internal fields on refetch", %{mock_modified: mock_modified} do
mock_modified.(%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/poll_modified.json")
+ body: File.read!("test/fixtures/tesla_mock/poll_modified.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
})
updated_object = Object.get_by_id_and_maybe_refetch(object.id, interval: -1)
diff --git a/test/pleroma/pagination_test.exs b/test/pleroma/pagination_test.exs
index e526f23e8..5ee1e60ae 100644
--- a/test/pleroma/pagination_test.exs
+++ b/test/pleroma/pagination_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.PaginationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/registration_test.exs b/test/pleroma/registration_test.exs
index 7db8e3664..462ab452b 100644
--- a/test/pleroma/registration_test.exs
+++ b/test/pleroma/registration_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.RegistrationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/repo/migrations/fix_legacy_tags_test.exs b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs
index 432055e45..adfed1142 100644
--- a/test/pleroma/repo/migrations/fix_legacy_tags_test.exs
+++ b/test/pleroma/repo/migrations/fix_legacy_tags_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.Repo.Migrations.FixLegacyTagsTest do
alias Pleroma.User
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
import Pleroma.Tests.Helpers
diff --git a/test/pleroma/repo/migrations/move_welcome_settings_test.exs b/test/pleroma/repo/migrations/move_welcome_settings_test.exs
index 53d05a55a..5dbe9d7b0 100644
--- a/test/pleroma/repo/migrations/move_welcome_settings_test.exs
+++ b/test/pleroma/repo/migrations/move_welcome_settings_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Repo.Migrations.MoveWelcomeSettingsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
import Pleroma.Tests.Helpers
alias Pleroma.ConfigDB
diff --git a/test/pleroma/repo_test.exs b/test/pleroma/repo_test.exs
index 155791be2..eaddef3a6 100644
--- a/test/pleroma/repo_test.exs
+++ b/test/pleroma/repo_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.RepoTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.User
diff --git a/test/pleroma/report_note_test.exs b/test/pleroma/report_note_test.exs
index 25c1d6a61..cc4561eea 100644
--- a/test/pleroma/report_note_test.exs
+++ b/test/pleroma/report_note_test.exs
@@ -4,7 +4,7 @@
defmodule Pleroma.ReportNoteTest do
alias Pleroma.ReportNote
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
test "create/3" do
diff --git a/test/pleroma/reverse_proxy_test.exs b/test/pleroma/reverse_proxy_test.exs
index 8df63de65..0a2c169ce 100644
--- a/test/pleroma/reverse_proxy_test.exs
+++ b/test/pleroma/reverse_proxy_test.exs
@@ -3,8 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.ReverseProxyTest do
- use Pleroma.Web.ConnCase, async: true
-
+ use Pleroma.Web.ConnCase
import ExUnit.CaptureLog
import Mox
diff --git a/test/pleroma/safe_jsonb_set_test.exs b/test/pleroma/safe_jsonb_set_test.exs
index 8b1274545..6d70f1026 100644
--- a/test/pleroma/safe_jsonb_set_test.exs
+++ b/test/pleroma/safe_jsonb_set_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.SafeJsonbSetTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
test "it doesn't wipe the object when asked to set the value to NULL" do
assert %{rows: [[%{"key" => "value", "test" => nil}]]} =
diff --git a/test/pleroma/stats_test.exs b/test/pleroma/stats_test.exs
index 74bf785b0..6c2fd5726 100644
--- a/test/pleroma/stats_test.exs
+++ b/test/pleroma/stats_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.StatsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/upload/filter/dedupe_test.exs b/test/pleroma/upload/filter/dedupe_test.exs
index 92a3d7df3..6559cbb50 100644
--- a/test/pleroma/upload/filter/dedupe_test.exs
+++ b/test/pleroma/upload/filter/dedupe_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.DedupeTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Upload
alias Pleroma.Upload.Filter.Dedupe
diff --git a/test/pleroma/upload/filter/exiftool_test.exs b/test/pleroma/upload/filter/exiftool_test.exs
index 6b978b64c..b5a5ba18d 100644
--- a/test/pleroma/upload/filter/exiftool_test.exs
+++ b/test/pleroma/upload/filter/exiftool_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Upload.Filter.ExiftoolTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Upload.Filter
test "apply exiftool filter" do
diff --git a/test/pleroma/uploaders/local_test.exs b/test/pleroma/uploaders/local_test.exs
index 1ce7be485..5b377d580 100644
--- a/test/pleroma/uploaders/local_test.exs
+++ b/test/pleroma/uploaders/local_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Uploaders.LocalTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Uploaders.Local
describe "get_file/1" do
diff --git a/test/pleroma/user/import_test.exs b/test/pleroma/user/import_test.exs
index e404deeb5..e198cdc08 100644
--- a/test/pleroma/user/import_test.exs
+++ b/test/pleroma/user/import_test.exs
@@ -30,7 +30,7 @@ test "it imports user followings from list" do
assert {:ok, result} = ObanHelpers.perform(job)
assert is_list(result)
- assert result == [user2, user3]
+ assert result == [refresh_record(user2), refresh_record(user3)]
assert User.following?(user1, user2)
assert User.following?(user1, user3)
end
diff --git a/test/pleroma/user/notification_setting_test.exs b/test/pleroma/user/notification_setting_test.exs
index 308da216a..701130380 100644
--- a/test/pleroma/user/notification_setting_test.exs
+++ b/test/pleroma/user/notification_setting_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.User.NotificationSettingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.User.NotificationSetting
diff --git a/test/pleroma/user_relationship_test.exs b/test/pleroma/user_relationship_test.exs
index f12406097..da4982065 100644
--- a/test/pleroma/user_relationship_test.exs
+++ b/test/pleroma/user_relationship_test.exs
@@ -5,7 +5,7 @@
defmodule Pleroma.UserRelationshipTest do
alias Pleroma.UserRelationship
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/user_search_test.exs b/test/pleroma/user_search_test.exs
index 31d787ffa..accb0b816 100644
--- a/test/pleroma/user_search_test.exs
+++ b/test/pleroma/user_search_test.exs
@@ -65,12 +65,13 @@ test "excludes invisible users from results" do
assert found_user.id == user.id
end
- test "excludes users when discoverable is false" do
+ # Note: as in Mastodon, `is_discoverable` doesn't anyhow relate to user searchability
+ test "includes non-discoverable users in results" do
insert(:user, %{nickname: "john 3000", is_discoverable: false})
insert(:user, %{nickname: "john 3001"})
users = User.search("john")
- assert Enum.count(users) == 1
+ assert Enum.count(users) == 2
end
test "excludes service actors from results" do
@@ -150,8 +151,8 @@ test "finds users, boosting ranks of friends and followers" do
follower = insert(:user, %{name: "Doe"})
friend = insert(:user, %{name: "Doe"})
- {:ok, follower} = User.follow(follower, u1)
- {:ok, u1} = User.follow(u1, friend)
+ {:ok, follower, u1} = User.follow(follower, u1)
+ {:ok, u1, friend} = User.follow(u1, friend)
assert [friend.id, follower.id, u2.id] --
Enum.map(User.search("doe", resolve: false, for_user: u1), & &1.id) == []
@@ -164,9 +165,9 @@ test "finds followings of user by partial name" do
following_jimi = insert(:user, %{name: "Lizz Wright"})
follower_lizz = insert(:user, %{name: "Jimi"})
- {:ok, lizz} = User.follow(lizz, following_lizz)
- {:ok, _jimi} = User.follow(jimi, following_jimi)
- {:ok, _follower_lizz} = User.follow(follower_lizz, lizz)
+ {:ok, lizz, following_lizz} = User.follow(lizz, following_lizz)
+ {:ok, _jimi, _following_jimi} = User.follow(jimi, following_jimi)
+ {:ok, _follower_lizz, _lizz} = User.follow(follower_lizz, lizz)
assert Enum.map(User.search("jimi", following: true, for_user: lizz), & &1.id) == [
following_lizz.id
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs
index 9ae52d594..40bbcad0b 100644
--- a/test/pleroma/user_test.exs
+++ b/test/pleroma/user_test.exs
@@ -233,7 +233,7 @@ test "follow_all follows mutliple users" do
{:ok, _user_relationship} = User.block(user, blocked)
{:ok, _user_relationship} = User.block(reverse_blocked, user)
- {:ok, user} = User.follow(user, followed_zero)
+ {:ok, user, followed_zero} = User.follow(user, followed_zero)
{:ok, user} = User.follow_all(user, [followed_one, followed_two, blocked, reverse_blocked])
@@ -262,7 +262,7 @@ test "follow takes a user and another user" do
user = insert(:user)
followed = insert(:user)
- {:ok, user} = User.follow(user, followed)
+ {:ok, user, followed} = User.follow(user, followed)
user = User.get_cached_by_id(user.id)
followed = User.get_cached_by_ap_id(followed.ap_id)
@@ -302,7 +302,7 @@ test "local users do not automatically follow local locked accounts" do
follower = insert(:user, is_locked: true)
followed = insert(:user, is_locked: true)
- {:ok, follower} = User.maybe_direct_follow(follower, followed)
+ {:ok, follower, followed} = User.maybe_direct_follow(follower, followed)
refute User.following?(follower, followed)
end
@@ -330,7 +330,7 @@ test "unfollow with syncronizes external user" do
following_address: "http://localhost:4001/users/fuser2/following"
})
- {:ok, user} = User.follow(user, followed, :follow_accept)
+ {:ok, user, followed} = User.follow(user, followed, :follow_accept)
{:ok, user, _activity} = User.unfollow(user, followed)
@@ -343,7 +343,7 @@ test "unfollow takes a user and another user" do
followed = insert(:user)
user = insert(:user)
- {:ok, user} = User.follow(user, followed, :follow_accept)
+ {:ok, user, followed} = User.follow(user, followed, :follow_accept)
assert User.following(user) == [user.follower_address, followed.follower_address]
@@ -535,6 +535,22 @@ test "it sends a confirm email" do
|> assert_email_sent()
end
+ test "sends a pending approval email" do
+ clear_config([:instance, :account_approval_required], true)
+
+ {:ok, user} =
+ User.register_changeset(%User{}, @full_user_data)
+ |> User.register()
+
+ ObanHelpers.perform_all()
+
+ assert_email_sent(
+ from: Pleroma.Config.Helpers.sender(),
+ to: {user.name, user.email},
+ subject: "Your account is awaiting approval"
+ )
+ end
+
test "it requires an email, name, nickname and password, bio is optional when account_activation_required is enabled" do
Pleroma.Config.put([:instance, :account_activation_required], true)
@@ -895,6 +911,13 @@ test "it has required fields" do
refute cs.valid?
end)
end
+
+ test "it is invalid given a local user" do
+ user = insert(:user)
+ cs = User.remote_user_changeset(user, %{name: "tom from myspace"})
+
+ refute cs.valid?
+ end
end
describe "followers and friends" do
@@ -904,8 +927,8 @@ test "gets all followers for a given user" do
follower_two = insert(:user)
not_follower = insert(:user)
- {:ok, follower_one} = User.follow(follower_one, user)
- {:ok, follower_two} = User.follow(follower_two, user)
+ {:ok, follower_one, user} = User.follow(follower_one, user)
+ {:ok, follower_two, user} = User.follow(follower_two, user)
res = User.get_followers(user)
@@ -920,8 +943,8 @@ test "gets all friends (followed users) for a given user" do
followed_two = insert(:user)
not_followed = insert(:user)
- {:ok, user} = User.follow(user, followed_one)
- {:ok, user} = User.follow(user, followed_two)
+ {:ok, user, followed_one} = User.follow(user, followed_one)
+ {:ok, user, followed_two} = User.follow(user, followed_two)
res = User.get_friends(user)
@@ -1008,6 +1031,27 @@ test "it mutes people" do
assert User.muted_notifications?(user, muted_user)
end
+ test "expiring" do
+ user = insert(:user)
+ muted_user = insert(:user)
+
+ {:ok, _user_relationships} = User.mute(user, muted_user, %{expires_in: 60})
+ assert User.mutes?(user, muted_user)
+
+ worker = Pleroma.Workers.MuteExpireWorker
+ args = %{"op" => "unmute_user", "muter_id" => user.id, "mutee_id" => muted_user.id}
+
+ assert_enqueued(
+ worker: worker,
+ args: args
+ )
+
+ assert :ok = perform_job(worker, args)
+
+ refute User.mutes?(user, muted_user)
+ refute User.muted_notifications?(user, muted_user)
+ end
+
test "it unmutes users" do
user = insert(:user)
muted_user = insert(:user)
@@ -1019,6 +1063,17 @@ test "it unmutes users" do
refute User.muted_notifications?(user, muted_user)
end
+ test "it unmutes users by id" do
+ user = insert(:user)
+ muted_user = insert(:user)
+
+ {:ok, _user_relationships} = User.mute(user, muted_user)
+ {:ok, _user_mute} = User.unmute(user.id, muted_user.id)
+
+ refute User.mutes?(user, muted_user)
+ refute User.muted_notifications?(user, muted_user)
+ end
+
test "it mutes user without notifications" do
user = insert(:user)
muted_user = insert(:user)
@@ -1026,7 +1081,7 @@ test "it mutes user without notifications" do
refute User.mutes?(user, muted_user)
refute User.muted_notifications?(user, muted_user)
- {:ok, _user_relationships} = User.mute(user, muted_user, false)
+ {:ok, _user_relationships} = User.mute(user, muted_user, %{notifications: false})
assert User.mutes?(user, muted_user)
refute User.muted_notifications?(user, muted_user)
@@ -1059,8 +1114,8 @@ test "blocks tear down cyclical follow relationships" do
blocker = insert(:user)
blocked = insert(:user)
- {:ok, blocker} = User.follow(blocker, blocked)
- {:ok, blocked} = User.follow(blocked, blocker)
+ {:ok, blocker, blocked} = User.follow(blocker, blocked)
+ {:ok, blocked, blocker} = User.follow(blocked, blocker)
assert User.following?(blocker, blocked)
assert User.following?(blocked, blocker)
@@ -1078,7 +1133,7 @@ test "blocks tear down blocker->blocked follow relationships" do
blocker = insert(:user)
blocked = insert(:user)
- {:ok, blocker} = User.follow(blocker, blocked)
+ {:ok, blocker, blocked} = User.follow(blocker, blocked)
assert User.following?(blocker, blocked)
refute User.following?(blocked, blocker)
@@ -1096,7 +1151,7 @@ test "blocks tear down blocked->blocker follow relationships" do
blocker = insert(:user)
blocked = insert(:user)
- {:ok, blocked} = User.follow(blocked, blocker)
+ {:ok, blocked, blocker} = User.follow(blocked, blocker)
refute User.following?(blocker, blocked)
assert User.following?(blocked, blocker)
@@ -1194,7 +1249,7 @@ test "follows take precedence over domain blocks" do
good_eggo = insert(:user, %{ap_id: "https://meanies.social/user/cuteposter"})
{:ok, user} = User.block_domain(user, "meanies.social")
- {:ok, user} = User.follow(user, good_eggo)
+ {:ok, user, good_eggo} = User.follow(user, good_eggo)
refute User.blocks?(user, good_eggo)
end
@@ -1228,8 +1283,8 @@ test "get recipients" do
assert Enum.map([actor, addressed], & &1.ap_id) --
Enum.map(User.get_recipients_from_activity(activity), & &1.ap_id) == []
- {:ok, user} = User.follow(user, actor)
- {:ok, _user_two} = User.follow(user_two, actor)
+ {:ok, user, actor} = User.follow(user, actor)
+ {:ok, _user_two, _actor} = User.follow(user_two, actor)
recipients = User.get_recipients_from_activity(activity)
assert length(recipients) == 3
assert user in recipients
@@ -1250,8 +1305,8 @@ test "has following" do
assert Enum.map([actor, addressed], & &1.ap_id) --
Enum.map(User.get_recipients_from_activity(activity), & &1.ap_id) == []
- {:ok, _actor} = User.follow(actor, user)
- {:ok, _actor} = User.follow(actor, user_two)
+ {:ok, _actor, _user} = User.follow(actor, user)
+ {:ok, _actor, _user_two} = User.follow(actor, user_two)
recipients = User.get_recipients_from_activity(activity)
assert length(recipients) == 2
assert addressed in recipients
@@ -1272,7 +1327,7 @@ test "hide a user from followers" do
user = insert(:user)
user2 = insert(:user)
- {:ok, user} = User.follow(user, user2)
+ {:ok, user, user2} = User.follow(user, user2)
{:ok, _user} = User.deactivate(user)
user2 = User.get_cached_by_id(user2.id)
@@ -1285,7 +1340,7 @@ test "hide a user from friends" do
user = insert(:user)
user2 = insert(:user)
- {:ok, user2} = User.follow(user2, user)
+ {:ok, user2, user} = User.follow(user2, user)
assert user2.following_count == 1
assert User.following_count(user2) == 1
@@ -1303,7 +1358,7 @@ test "hide a user's statuses from timelines and notifications" do
user = insert(:user)
user2 = insert(:user)
- {:ok, user2} = User.follow(user2, user)
+ {:ok, user2, user} = User.follow(user2, user)
{:ok, activity} = CommonAPI.post(user, %{status: "hey @#{user2.nickname}"})
@@ -1354,6 +1409,98 @@ test "approves a list of users" do
assert false == user.approval_pending
end)
end
+
+ test "it sends welcome email if it is set" do
+ clear_config([:welcome, :email, :enabled], true)
+ clear_config([:welcome, :email, :sender], "tester@test.me")
+
+ user = insert(:user, approval_pending: true)
+ welcome_user = insert(:user, email: "tester@test.me")
+ instance_name = Pleroma.Config.get([:instance, :name])
+
+ User.approve(user)
+
+ ObanHelpers.perform_all()
+
+ assert_email_sent(
+ from: {instance_name, welcome_user.email},
+ to: {user.name, user.email},
+ html_body: "Welcome to #{instance_name}"
+ )
+ end
+
+ test "approving an approved user does not trigger post-register actions" do
+ clear_config([:welcome, :email, :enabled], true)
+
+ user = insert(:user, approval_pending: false)
+ User.approve(user)
+
+ ObanHelpers.perform_all()
+
+ assert_no_email_sent()
+ end
+ end
+
+ describe "confirm" do
+ test "confirms a user" do
+ user = insert(:user, confirmation_pending: true)
+ assert true == user.confirmation_pending
+ {:ok, user} = User.confirm(user)
+ assert false == user.confirmation_pending
+ end
+
+ test "confirms a list of users" do
+ unconfirmed_users = [
+ insert(:user, confirmation_pending: true),
+ insert(:user, confirmation_pending: true),
+ insert(:user, confirmation_pending: true)
+ ]
+
+ {:ok, users} = User.confirm(unconfirmed_users)
+
+ assert Enum.count(users) == 3
+
+ Enum.each(users, fn user ->
+ assert false == user.confirmation_pending
+ end)
+ end
+
+ test "sends approval emails when `approval_pending: true`" do
+ admin = insert(:user, is_admin: true)
+ user = insert(:user, confirmation_pending: true, approval_pending: true)
+ User.confirm(user)
+
+ ObanHelpers.perform_all()
+
+ user_email = Pleroma.Emails.UserEmail.approval_pending_email(user)
+ admin_email = Pleroma.Emails.AdminEmail.new_unapproved_registration(admin, user)
+
+ notify_email = Pleroma.Config.get([:instance, :notify_email])
+ instance_name = Pleroma.Config.get([:instance, :name])
+
+ # User approval email
+ assert_email_sent(
+ from: {instance_name, notify_email},
+ to: {user.name, user.email},
+ html_body: user_email.html_body
+ )
+
+ # Admin email
+ assert_email_sent(
+ from: {instance_name, notify_email},
+ to: {admin.name, admin.email},
+ html_body: admin_email.html_body
+ )
+ end
+
+ test "confirming a confirmed user does not trigger post-register actions" do
+ user = insert(:user, confirmation_pending: false, approval_pending: true)
+ User.confirm(user)
+
+ ObanHelpers.perform_all()
+
+ assert_no_email_sent()
+ end
end
describe "delete" do
@@ -1376,10 +1523,10 @@ test ".delete_user_activities deletes all create activities", %{user: user} do
test "it deactivates a user, all follow relationships and all activities", %{user: user} do
follower = insert(:user)
- {:ok, follower} = User.follow(follower, user)
+ {:ok, follower, user} = User.follow(follower, user)
locked_user = insert(:user, name: "locked", is_locked: true)
- {:ok, _} = User.follow(user, locked_user, :follow_pending)
+ {:ok, _, _} = User.follow(user, locked_user, :follow_pending)
object = insert(:note, user: user)
activity = insert(:note_activity, user: user, note: object)
@@ -1737,9 +1884,9 @@ test "follower count is updated when a follower is blocked" do
follower2 = insert(:user)
follower3 = insert(:user)
- {:ok, follower} = User.follow(follower, user)
- {:ok, _follower2} = User.follow(follower2, user)
- {:ok, _follower3} = User.follow(follower3, user)
+ {:ok, follower, user} = User.follow(follower, user)
+ {:ok, _follower2, _user} = User.follow(follower2, user)
+ {:ok, _follower3, _user} = User.follow(follower3, user)
{:ok, _user_relationship} = User.block(user, follower)
user = refresh_record(user)
@@ -1850,24 +1997,6 @@ test "Only includes users with no read notifications" do
end
end
- describe "toggle_confirmation/1" do
- test "if user is confirmed" do
- user = insert(:user, confirmation_pending: false)
- {:ok, user} = User.toggle_confirmation(user)
-
- assert user.confirmation_pending
- assert user.confirmation_token
- end
-
- test "if user is unconfirmed" do
- user = insert(:user, confirmation_pending: true, confirmation_token: "some token")
- {:ok, user} = User.toggle_confirmation(user)
-
- refute user.confirmation_pending
- refute user.confirmation_token
- end
- end
-
describe "ensure_keys_present" do
test "it creates keys for a user and stores them in info" do
user = insert(:user)
@@ -1980,8 +2109,7 @@ test "updates the counters normally on following/getting a follow when disabled"
assert other_user.following_count == 0
assert other_user.follower_count == 0
- {:ok, user} = Pleroma.User.follow(user, other_user)
- other_user = Pleroma.User.get_by_id(other_user.id)
+ {:ok, user, other_user} = Pleroma.User.follow(user, other_user)
assert user.following_count == 1
assert other_user.follower_count == 1
@@ -2004,8 +2132,7 @@ test "syncronizes the counters with the remote instance for the followed when en
assert other_user.follower_count == 0
Pleroma.Config.put([:instance, :external_user_synchronization], true)
- {:ok, _user} = User.follow(user, other_user)
- other_user = User.get_by_id(other_user.id)
+ {:ok, _user, other_user} = User.follow(user, other_user)
assert other_user.follower_count == 437
end
@@ -2027,7 +2154,7 @@ test "syncronizes the counters with the remote instance for the follower when en
assert other_user.follower_count == 0
Pleroma.Config.put([:instance, :external_user_synchronization], true)
- {:ok, other_user} = User.follow(other_user, user)
+ {:ok, other_user, _user} = User.follow(other_user, user)
assert other_user.following_count == 152
end
@@ -2139,4 +2266,9 @@ test "avatar fallback" do
assert User.avatar_url(user, no_default: true) == nil
end
+
+ test "get_host/1" do
+ user = insert(:user, ap_id: "https://lain.com/users/lain", nickname: "lain")
+ assert User.get_host(user) == "lain.com"
+ end
end
diff --git a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
index b696a24f4..0063d0482 100644
--- a/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_controller_test.exs
@@ -213,6 +213,23 @@ test "it returns a json representation of the activity with accept application/j
end
describe "/objects/:uuid" do
+ test "it doesn't return a local-only object", %{conn: conn} do
+ user = insert(:user)
+ {:ok, post} = CommonAPI.post(user, %{status: "test", visibility: "local"})
+
+ assert Pleroma.Web.ActivityPub.Visibility.is_local_public?(post)
+
+ object = Object.normalize(post, false)
+ uuid = String.split(object.data["id"], "/") |> List.last()
+
+ conn =
+ conn
+ |> put_req_header("accept", "application/json")
+ |> get("/objects/#{uuid}")
+
+ assert json_response(conn, 404)
+ end
+
test "it returns a json representation of the object with accept application/json", %{
conn: conn
} do
@@ -326,6 +343,22 @@ test "cached purged after object deletion", %{conn: conn} do
end
describe "/activities/:uuid" do
+ test "it doesn't return a local-only activity", %{conn: conn} do
+ user = insert(:user)
+ {:ok, post} = CommonAPI.post(user, %{status: "test", visibility: "local"})
+
+ assert Pleroma.Web.ActivityPub.Visibility.is_local_public?(post)
+
+ uuid = String.split(post.data["id"], "/") |> List.last()
+
+ conn =
+ conn
+ |> put_req_header("accept", "application/json")
+ |> get("/activities/#{uuid}")
+
+ assert json_response(conn, 404)
+ end
+
test "it returns a json representation of the activity", %{conn: conn} do
activity = insert(:note_activity)
uuid = String.split(activity.data["id"], "/") |> List.last()
@@ -398,7 +431,7 @@ test "cached purged after activity deletion", %{conn: conn} do
describe "/inbox" do
test "it inserts an incoming activity into the database", %{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
conn =
conn
@@ -426,7 +459,7 @@ test "it inserts an incoming activity into the database" <>
data =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", user.ap_id)
|> put_in(["object", "attridbutedTo"], user.ap_id)
@@ -443,7 +476,7 @@ test "it inserts an incoming activity into the database" <>
end
test "it clears `unreachable` federation status of the sender", %{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
sender_url = data["actor"]
Instances.set_consistently_unreachable(sender_url)
@@ -501,8 +534,8 @@ test "accept follow activity", %{conn: conn} do
test "without valid signature, " <>
"it only accepts Create activities and requires enabled federation",
%{conn: conn} do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
- non_create_data = File.read!("test/fixtures/mastodon-announce.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
+ non_create_data = File.read!("test/fixtures/mastodon-announce.json") |> Jason.decode!()
conn = put_req_header(conn, "content-type", "application/activity+json")
@@ -531,7 +564,7 @@ test "without valid signature, " <>
setup do
data =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
[data: data]
end
@@ -642,7 +675,7 @@ test "it accepts messages from actors that are followed by the user", %{
recipient = insert(:user)
actor = insert(:user, %{ap_id: "http://mastodon.example.org/users/actor"})
- {:ok, recipient} = User.follow(recipient, actor)
+ {:ok, recipient, actor} = User.follow(recipient, actor)
object =
data["object"]
@@ -714,7 +747,7 @@ test "it removes all follower collections but actor's", %{conn: conn} do
data =
File.read!("test/fixtures/activitypub-client-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
object = Map.put(data["object"], "attributedTo", actor.ap_id)
@@ -766,6 +799,142 @@ test "it requires authentication", %{conn: conn} do
assert json_response(ret_conn, 200)
end
+
+ @tag capture_log: true
+ test "forwarded report", %{conn: conn} do
+ admin = insert(:user, is_admin: true)
+ actor = insert(:user, local: false)
+ remote_domain = URI.parse(actor.ap_id).host
+ reported_user = insert(:user)
+
+ note = insert(:note_activity, user: reported_user)
+
+ data = %{
+ "@context" => [
+ "https://www.w3.org/ns/activitystreams",
+ "https://#{remote_domain}/schemas/litepub-0.1.jsonld",
+ %{
+ "@language" => "und"
+ }
+ ],
+ "actor" => actor.ap_id,
+ "cc" => [
+ reported_user.ap_id
+ ],
+ "content" => "test",
+ "context" => "context",
+ "id" => "http://#{remote_domain}/activities/02be56cf-35e3-46b4-b2c6-47ae08dfee9e",
+ "nickname" => reported_user.nickname,
+ "object" => [
+ reported_user.ap_id,
+ %{
+ "actor" => %{
+ "actor_type" => "Person",
+ "approval_pending" => false,
+ "avatar" => "",
+ "confirmation_pending" => false,
+ "deactivated" => false,
+ "display_name" => "test user",
+ "id" => reported_user.id,
+ "local" => false,
+ "nickname" => reported_user.nickname,
+ "registration_reason" => nil,
+ "roles" => %{
+ "admin" => false,
+ "moderator" => false
+ },
+ "tags" => [],
+ "url" => reported_user.ap_id
+ },
+ "content" => "",
+ "id" => note.data["id"],
+ "published" => note.data["published"],
+ "type" => "Note"
+ }
+ ],
+ "published" => note.data["published"],
+ "state" => "open",
+ "to" => [],
+ "type" => "Flag"
+ }
+
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/users/#{reported_user.nickname}/inbox", data)
+ |> json_response(200)
+
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
+
+ assert Pleroma.Repo.aggregate(Activity, :count, :id) == 2
+
+ ObanHelpers.perform_all()
+
+ Swoosh.TestAssertions.assert_email_sent(
+ to: {admin.name, admin.email},
+ html_body: ~r/Reported Account:/i
+ )
+ end
+
+ @tag capture_log: true
+ test "forwarded report from mastodon", %{conn: conn} do
+ admin = insert(:user, is_admin: true)
+ actor = insert(:user, local: false)
+ remote_domain = URI.parse(actor.ap_id).host
+ remote_actor = "https://#{remote_domain}/actor"
+ [reported_user, another] = insert_list(2, :user)
+
+ note = insert(:note_activity, user: reported_user)
+
+ Pleroma.Web.CommonAPI.favorite(another, note.id)
+
+ mock_json_body =
+ "test/fixtures/mastodon/application_actor.json"
+ |> File.read!()
+ |> String.replace("{{DOMAIN}}", remote_domain)
+
+ Tesla.Mock.mock(fn %{url: ^remote_actor} ->
+ %Tesla.Env{
+ status: 200,
+ body: mock_json_body,
+ headers: [{"content-type", "application/activity+json"}]
+ }
+ end)
+
+ data = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "actor" => remote_actor,
+ "content" => "test report",
+ "id" => "https://#{remote_domain}/e3b12fd1-948c-446e-b93b-a5e67edbe1d8",
+ "nickname" => reported_user.nickname,
+ "object" => [
+ reported_user.ap_id,
+ note.data["object"]
+ ],
+ "type" => "Flag"
+ }
+
+ conn
+ |> assign(:valid_signature, true)
+ |> put_req_header("content-type", "application/activity+json")
+ |> post("/users/#{reported_user.nickname}/inbox", data)
+ |> json_response(200)
+
+ ObanHelpers.perform(all_enqueued(worker: ReceiverWorker))
+
+ flag_activity = "Flag" |> Pleroma.Activity.Queries.by_type() |> Pleroma.Repo.one()
+ reported_user_ap_id = reported_user.ap_id
+
+ [^reported_user_ap_id, flag_data] = flag_activity.data["object"]
+
+ Enum.each(~w(actor content id published type), &Map.has_key?(flag_data, &1))
+ ObanHelpers.perform_all()
+
+ Swoosh.TestAssertions.assert_email_sent(
+ to: {admin.name, admin.email},
+ html_body: ~r/#{note.data["object"]}/i
+ )
+ end
end
describe "GET /users/:nickname/outbox" do
diff --git a/test/pleroma/web/activity_pub/activity_pub_test.exs b/test/pleroma/web/activity_pub/activity_pub_test.exs
index a14895104..3027d4370 100644
--- a/test/pleroma/web/activity_pub/activity_pub_test.exs
+++ b/test/pleroma/web/activity_pub/activity_pub_test.exs
@@ -753,7 +753,7 @@ test "does return activities from followed users on blocked domains" do
domain_user = insert(:user, %{ap_id: "https://#{domain}/@pundit"})
blocker = insert(:user)
- {:ok, blocker} = User.follow(blocker, domain_user)
+ {:ok, blocker, domain_user} = User.follow(blocker, domain_user)
{:ok, blocker} = User.block_domain(blocker, domain)
assert User.following?(blocker, domain_user)
@@ -880,7 +880,7 @@ test "does include announces on request" do
user = insert(:user)
booster = insert(:user)
- {:ok, user} = User.follow(user, booster)
+ {:ok, user, booster} = User.follow(user, booster)
{:ok, announce} = CommonAPI.repeat(activity_three.id, booster)
@@ -1185,13 +1185,13 @@ test "it filters broken threads" do
user2 = insert(:user)
user3 = insert(:user)
- {:ok, user1} = User.follow(user1, user3)
+ {:ok, user1, user3} = User.follow(user1, user3)
assert User.following?(user1, user3)
- {:ok, user2} = User.follow(user2, user3)
+ {:ok, user2, user3} = User.follow(user2, user3)
assert User.following?(user2, user3)
- {:ok, user3} = User.follow(user3, user2)
+ {:ok, user3, user2} = User.follow(user3, user2)
assert User.following?(user3, user2)
{:ok, public_activity} = CommonAPI.post(user3, %{status: "hi 1"})
@@ -1325,6 +1325,31 @@ test "it can create a Flag activity",
assert_called(Utils.maybe_federate(%{activity | data: new_data}))
end
+
+ test_with_mock "reverts on error",
+ %{
+ reporter: reporter,
+ context: context,
+ target_account: target_account,
+ reported_activity: reported_activity,
+ content: content
+ },
+ Utils,
+ [:passthrough],
+ maybe_federate: fn _ -> {:error, :reverted} end do
+ assert {:error, :reverted} =
+ ActivityPub.flag(%{
+ actor: reporter,
+ context: context,
+ account: target_account,
+ statuses: [reported_activity],
+ content: content
+ })
+
+ assert Repo.aggregate(Activity, :count, :id) == 1
+ assert Repo.aggregate(Object, :count, :id) == 2
+ assert Repo.aggregate(Notification, :count, :id) == 0
+ end
end
test "fetch_activities/2 returns activities addressed to a list " do
@@ -1453,19 +1478,25 @@ test "doesn't crash when follower and following counters are hidden" do
mock(fn env ->
case env.url do
"http://localhost:4001/users/masto_hidden_counters/following" ->
- json(%{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "id" => "http://localhost:4001/users/masto_hidden_counters/followers"
- })
+ json(
+ %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "id" => "http://localhost:4001/users/masto_hidden_counters/followers"
+ },
+ headers: HttpRequestMock.activitypub_object_headers()
+ )
"http://localhost:4001/users/masto_hidden_counters/following?page=1" ->
%Tesla.Env{status: 403, body: ""}
"http://localhost:4001/users/masto_hidden_counters/followers" ->
- json(%{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "id" => "http://localhost:4001/users/masto_hidden_counters/following"
- })
+ json(
+ %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "id" => "http://localhost:4001/users/masto_hidden_counters/following"
+ },
+ headers: HttpRequestMock.activitypub_object_headers()
+ )
"http://localhost:4001/users/masto_hidden_counters/followers?page=1" ->
%Tesla.Env{status: 403, body: ""}
@@ -1927,13 +1958,13 @@ test "home timeline with default reply_visibility `self`", %{
defp public_messages(_) do
[u1, u2, u3, u4] = insert_list(4, :user)
- {:ok, u1} = User.follow(u1, u2)
- {:ok, u2} = User.follow(u2, u1)
- {:ok, u1} = User.follow(u1, u4)
- {:ok, u4} = User.follow(u4, u1)
+ {:ok, u1, u2} = User.follow(u1, u2)
+ {:ok, u2, u1} = User.follow(u2, u1)
+ {:ok, u1, u4} = User.follow(u1, u4)
+ {:ok, u4, u1} = User.follow(u4, u1)
- {:ok, u2} = User.follow(u2, u3)
- {:ok, u3} = User.follow(u3, u2)
+ {:ok, u2, u3} = User.follow(u2, u3)
+ {:ok, u3, u2} = User.follow(u3, u2)
{:ok, a1} = CommonAPI.post(u1, %{status: "Status"})
@@ -2026,15 +2057,15 @@ defp public_messages(_) do
defp private_messages(_) do
[u1, u2, u3, u4] = insert_list(4, :user)
- {:ok, u1} = User.follow(u1, u2)
- {:ok, u2} = User.follow(u2, u1)
- {:ok, u1} = User.follow(u1, u3)
- {:ok, u3} = User.follow(u3, u1)
- {:ok, u1} = User.follow(u1, u4)
- {:ok, u4} = User.follow(u4, u1)
+ {:ok, u1, u2} = User.follow(u1, u2)
+ {:ok, u2, u1} = User.follow(u2, u1)
+ {:ok, u1, u3} = User.follow(u1, u3)
+ {:ok, u3, u1} = User.follow(u3, u1)
+ {:ok, u1, u4} = User.follow(u1, u4)
+ {:ok, u4, u1} = User.follow(u4, u1)
- {:ok, u2} = User.follow(u2, u3)
- {:ok, u3} = User.follow(u3, u2)
+ {:ok, u2, u3} = User.follow(u2, u3)
+ {:ok, u3, u2} = User.follow(u3, u2)
{:ok, a1} = CommonAPI.post(u1, %{status: "Status", visibility: "private"})
@@ -2305,7 +2336,7 @@ test "allow fetching of accounts with an empty string name field" do
Tesla.Mock.mock(fn
%{method: :get, url: "https://princess.cat/users/mewmew"} ->
file = File.read!("test/fixtures/mewmew_no_name.json")
- %Tesla.Env{status: 200, body: file}
+ %Tesla.Env{status: 200, body: file, headers: HttpRequestMock.activitypub_object_headers()}
end)
{:ok, user} = ActivityPub.make_user_from_ap_id("https://princess.cat/users/mewmew")
diff --git a/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs
index 3c795f5ac..49bbc271d 100644
--- a/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/anti_followbot_policy_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicyTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.ActivityPub.MRF.AntiFollowbotPolicy
diff --git a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
index 9a283f27d..19ea491c0 100644
--- a/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/ensure_re_prepended_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.EnsureRePrependedTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Object
diff --git a/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
index 86dd9ddae..b5f401ad2 100644
--- a/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/force_bot_unlisted_policy_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicyTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.ActivityPub.MRF.ForceBotUnlistedPolicy
diff --git a/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs
index 1710c4d2a..84362ce78 100644
--- a/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/media_proxy_warming_policy_test.exs
@@ -3,10 +3,10 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
- use Pleroma.DataCase
+ use ExUnit.Case
+ use Pleroma.Tests.Helpers
alias Pleroma.HTTP
- alias Pleroma.Tests.ObanHelpers
alias Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicy
import Mock
@@ -25,13 +25,13 @@ defmodule Pleroma.Web.ActivityPub.MRF.MediaProxyWarmingPolicyTest do
setup do: clear_config([:media_proxy, :enabled], true)
test "it prefetches media proxy URIs" do
+ Tesla.Mock.mock(fn %{method: :get, url: "http://example.com/image.jpg"} ->
+ {:ok, %Tesla.Env{status: 200, body: ""}}
+ end)
+
with_mock HTTP, get: fn _, _, _ -> {:ok, []} end do
MediaProxyWarmingPolicy.filter(@message)
- ObanHelpers.perform_all()
- # Performing jobs which has been just enqueued
- ObanHelpers.perform_all()
-
assert called(HTTP.get(:_, :_, :_))
end
end
diff --git a/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs
index 64ea61dd4..d03456b34 100644
--- a/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/no_placeholder_text_policy_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicyTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.MRF.NoPlaceholderTextPolicy
test "it clears content object" do
diff --git a/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs
index 9b39c45bd..5fccf7760 100644
--- a/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/normalize_markup_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.NormalizeMarkupTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.MRF.NormalizeMarkup
@html_sample """
diff --git a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs
index cf6acc9a2..e8317b2af 100644
--- a/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/object_age_policy_test.exs
@@ -22,7 +22,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.ObjectAgePolicyTest do
defp get_old_message do
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
end
defp get_new_message do
diff --git a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs
index ffc30ba62..4f289739f 100644
--- a/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs
+++ b/test/pleroma/web/activity_pub/mrf/tag_policy_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.MRF.TagPolicyTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.ActivityPub.MRF.TagPolicy
diff --git a/test/pleroma/web/activity_pub/mrf_test.exs b/test/pleroma/web/activity_pub/mrf_test.exs
index e8cdde2e1..44a9cf086 100644
--- a/test/pleroma/web/activity_pub/mrf_test.exs
+++ b/test/pleroma/web/activity_pub/mrf_test.exs
@@ -87,4 +87,20 @@ test "it works as expected with mock policy" do
{:ok, ^expected} = MRF.describe()
end
end
+
+ test "config_descriptions/0" do
+ descriptions = MRF.config_descriptions()
+
+ good_mrf = Enum.find(descriptions, fn %{key: key} -> key == :good_mrf end)
+
+ assert good_mrf == %{
+ key: :good_mrf,
+ related_policy: "Fixtures.Modules.GoodMRF",
+ label: "Good MRF",
+ description: "Some description",
+ group: :pleroma,
+ tab: :mrf,
+ type: :group
+ }
+ end
end
diff --git a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs
index d6111ba41..bafa2a672 100644
--- a/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/accept_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.AcceptValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs
index 4771c4698..9613dea9b 100644
--- a/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/announce_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.AnnounceValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Builder
diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs
index cc6dab872..1f992b397 100644
--- a/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/article_note_validator_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidatorTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.ObjectValidators.ArticleNoteValidator
alias Pleroma.Web.ActivityPub.Utils
diff --git a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
index 760388e80..45e1d8852 100644
--- a/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/attachment_validator_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidatorTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.ObjectValidators.AttachmentValidator
@@ -33,7 +33,8 @@ test "it turns mastodon attachments into our attachments" do
"http://mastodon.example.org/system/media_attachments/files/000/000/002/original/334ce029e7bfb920.jpg",
"type" => "Document",
"name" => nil,
- "mediaType" => "image/jpeg"
+ "mediaType" => "image/jpeg",
+ "blurhash" => "UD9jJz~VSbR#xT$~%KtQX9R,WAs9RjWBs:of"
}
{:ok, attachment} =
@@ -50,6 +51,7 @@ test "it turns mastodon attachments into our attachments" do
] = attachment.url
assert attachment.mediaType == "image/jpeg"
+ assert attachment.blurhash == "UD9jJz~VSbR#xT$~%KtQX9R,WAs9RjWBs:of"
end
test "it handles our own uploads" do
diff --git a/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs
index c08d4b2e8..d133aeb1a 100644
--- a/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/block_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.BlockValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs
index 02683b899..57de83c8a 100644
--- a/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/delete_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.DeleteValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Object
alias Pleroma.Web.ActivityPub.Builder
diff --git a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs
index 582e6d785..342cfeef8 100644
--- a/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/emoji_react_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.EmojiReactHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs
index 6e1378be2..0f77ac8df 100644
--- a/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/follow_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.FollowValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs
index 2c033b7e2..4cda3742d 100644
--- a/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/like_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.LikeValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.ObjectValidator
alias Pleroma.Web.ActivityPub.ObjectValidators.LikeValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs
index 370bb6e5c..69f5e8ac4 100644
--- a/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/reject_validation_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.RejectValidationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs
index 75bbcc4b6..dc85d1ac3 100644
--- a/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/undo_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.UndoHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
index 5e80cf731..2c4a50bfd 100644
--- a/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
+++ b/test/pleroma/web/activity_pub/object_validators/update_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.ObjectValidators.UpdateHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.ActivityPub.ObjectValidator
diff --git a/test/pleroma/web/activity_pub/pipeline_test.exs b/test/pleroma/web/activity_pub/pipeline_test.exs
index 210a06563..d568d825b 100644
--- a/test/pleroma/web/activity_pub/pipeline_test.exs
+++ b/test/pleroma/web/activity_pub/pipeline_test.exs
@@ -3,14 +3,35 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.PipelineTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
- import Mock
+ import Mox
import Pleroma.Factory
+ alias Pleroma.ConfigMock
+ alias Pleroma.Web.ActivityPub.ActivityPubMock
+ alias Pleroma.Web.ActivityPub.MRFMock
+ alias Pleroma.Web.ActivityPub.ObjectValidatorMock
+ alias Pleroma.Web.ActivityPub.SideEffectsMock
+ alias Pleroma.Web.FederatorMock
+
+ setup :verify_on_exit!
+
describe "common_pipeline/2" do
setup do
- clear_config([:instance, :federating], true)
+ ObjectValidatorMock
+ |> expect(:validate, fn o, m -> {:ok, o, m} end)
+
+ MRFMock
+ |> expect(:pipeline_filter, fn o, m -> {:ok, o, m} end)
+
+ ActivityPubMock
+ |> expect(:persist, fn o, m -> {:ok, o, m} end)
+
+ SideEffectsMock
+ |> expect(:handle, fn o, m -> {:ok, o, m} end)
+ |> expect(:handle_after_transaction, fn m -> m end)
+
:ok
end
@@ -21,159 +42,53 @@ test "when given an `object_data` in meta, Federation will receive a the origina
activity_with_object = %{activity | data: Map.put(activity.data, "object", object)}
- with_mocks([
- {Pleroma.Web.ActivityPub.ObjectValidator, [], [validate: fn o, m -> {:ok, o, m} end]},
- {
- Pleroma.Web.ActivityPub.MRF,
- [],
- [pipeline_filter: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.ActivityPub,
- [],
- [persist: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.SideEffects,
- [],
- [
- handle: fn o, m -> {:ok, o, m} end,
- handle_after_transaction: fn m -> m end
- ]
- },
- {
- Pleroma.Web.Federator,
- [],
- [publish: fn _o -> :ok end]
- }
- ]) do
- assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ FederatorMock
+ |> expect(:publish, fn ^activity_with_object -> :ok end)
- assert_called(Pleroma.Web.ActivityPub.ObjectValidator.validate(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.MRF.pipeline_filter(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.ActivityPub.persist(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.SideEffects.handle(activity, meta))
- refute called(Pleroma.Web.Federator.publish(activity))
- assert_called(Pleroma.Web.Federator.publish(activity_with_object))
- end
+ ConfigMock
+ |> expect(:get, fn [:instance, :federating] -> true end)
+
+ assert {:ok, ^activity, ^meta} =
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(
+ activity,
+ meta
+ )
end
test "it goes through validation, filtering, persisting, side effects and federation for local activities" do
activity = insert(:note_activity)
meta = [local: true]
- with_mocks([
- {Pleroma.Web.ActivityPub.ObjectValidator, [], [validate: fn o, m -> {:ok, o, m} end]},
- {
- Pleroma.Web.ActivityPub.MRF,
- [],
- [pipeline_filter: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.ActivityPub,
- [],
- [persist: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.SideEffects,
- [],
- [
- handle: fn o, m -> {:ok, o, m} end,
- handle_after_transaction: fn m -> m end
- ]
- },
- {
- Pleroma.Web.Federator,
- [],
- [publish: fn _o -> :ok end]
- }
- ]) do
- assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ FederatorMock
+ |> expect(:publish, fn ^activity -> :ok end)
- assert_called(Pleroma.Web.ActivityPub.ObjectValidator.validate(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.MRF.pipeline_filter(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.ActivityPub.persist(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.SideEffects.handle(activity, meta))
- assert_called(Pleroma.Web.Federator.publish(activity))
- end
+ ConfigMock
+ |> expect(:get, fn [:instance, :federating] -> true end)
+
+ assert {:ok, ^activity, ^meta} =
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
end
test "it goes through validation, filtering, persisting, side effects without federation for remote activities" do
activity = insert(:note_activity)
meta = [local: false]
- with_mocks([
- {Pleroma.Web.ActivityPub.ObjectValidator, [], [validate: fn o, m -> {:ok, o, m} end]},
- {
- Pleroma.Web.ActivityPub.MRF,
- [],
- [pipeline_filter: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.ActivityPub,
- [],
- [persist: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.SideEffects,
- [],
- [handle: fn o, m -> {:ok, o, m} end, handle_after_transaction: fn m -> m end]
- },
- {
- Pleroma.Web.Federator,
- [],
- []
- }
- ]) do
- assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ ConfigMock
+ |> expect(:get, fn [:instance, :federating] -> true end)
- assert_called(Pleroma.Web.ActivityPub.ObjectValidator.validate(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.MRF.pipeline_filter(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.ActivityPub.persist(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.SideEffects.handle(activity, meta))
- end
+ assert {:ok, ^activity, ^meta} =
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
end
test "it goes through validation, filtering, persisting, side effects without federation for local activities if federation is deactivated" do
- clear_config([:instance, :federating], false)
-
activity = insert(:note_activity)
meta = [local: true]
- with_mocks([
- {Pleroma.Web.ActivityPub.ObjectValidator, [], [validate: fn o, m -> {:ok, o, m} end]},
- {
- Pleroma.Web.ActivityPub.MRF,
- [],
- [pipeline_filter: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.ActivityPub,
- [],
- [persist: fn o, m -> {:ok, o, m} end]
- },
- {
- Pleroma.Web.ActivityPub.SideEffects,
- [],
- [handle: fn o, m -> {:ok, o, m} end, handle_after_transaction: fn m -> m end]
- },
- {
- Pleroma.Web.Federator,
- [],
- []
- }
- ]) do
- assert {:ok, ^activity, ^meta} =
- Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
+ ConfigMock
+ |> expect(:get, fn [:instance, :federating] -> false end)
- assert_called(Pleroma.Web.ActivityPub.ObjectValidator.validate(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.MRF.pipeline_filter(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.ActivityPub.persist(activity, meta))
- assert_called(Pleroma.Web.ActivityPub.SideEffects.handle(activity, meta))
- end
+ assert {:ok, ^activity, ^meta} =
+ Pleroma.Web.ActivityPub.Pipeline.common_pipeline(activity, meta)
end
end
end
diff --git a/test/pleroma/web/activity_pub/publisher_test.exs b/test/pleroma/web/activity_pub/publisher_test.exs
index b9388b966..3503d25b2 100644
--- a/test/pleroma/web/activity_pub/publisher_test.exs
+++ b/test/pleroma/web/activity_pub/publisher_test.exs
@@ -281,8 +281,7 @@ test "publish to url with with different ports" do
actor = insert(:user, follower_address: follower.ap_id)
user = insert(:user)
- {:ok, _follower_one} = Pleroma.User.follow(follower, actor)
- actor = refresh_record(actor)
+ {:ok, follower, actor} = Pleroma.User.follow(follower, actor)
note_activity =
insert(:note_activity,
diff --git a/test/pleroma/web/activity_pub/relay_test.exs b/test/pleroma/web/activity_pub/relay_test.exs
index 3284980f7..a7cd732bb 100644
--- a/test/pleroma/web/activity_pub/relay_test.exs
+++ b/test/pleroma/web/activity_pub/relay_test.exs
@@ -84,7 +84,7 @@ test "force unfollow when target service is dead" do
)
Pleroma.Repo.delete(user)
- Cachex.clear(:user_cache)
+ User.invalidate_cache(user)
assert {:ok, %Activity{} = activity} = Relay.unfollow(user_ap_id, %{force: true})
diff --git a/test/pleroma/web/activity_pub/side_effects/delete_test.exs b/test/pleroma/web/activity_pub/side_effects/delete_test.exs
new file mode 100644
index 000000000..e4ad606a9
--- /dev/null
+++ b/test/pleroma/web/activity_pub/side_effects/delete_test.exs
@@ -0,0 +1,147 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.ActivityPub.SideEffects.DeleteTest do
+ use Oban.Testing, repo: Pleroma.Repo
+ use Pleroma.DataCase, async: true
+
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.Repo
+ alias Pleroma.Tests.ObanHelpers
+ alias Pleroma.User
+ alias Pleroma.Web.ActivityPub.ActivityPub
+ alias Pleroma.Web.ActivityPub.Builder
+ alias Pleroma.Web.ActivityPub.SideEffects
+ alias Pleroma.Web.CommonAPI
+
+ alias Pleroma.LoggerMock
+ alias Pleroma.Web.ActivityPub.ActivityPubMock
+
+ import Mox
+ import Pleroma.Factory
+
+ describe "user deletion" do
+ setup do
+ user = insert(:user)
+
+ {:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id)
+ {:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true)
+
+ %{
+ user: user,
+ delete_user: delete_user
+ }
+ end
+
+ test "it handles user deletions", %{delete_user: delete, user: user} do
+ {:ok, _delete, _} = SideEffects.handle(delete)
+ ObanHelpers.perform_all()
+
+ assert User.get_cached_by_ap_id(user.ap_id).deactivated
+ end
+ end
+
+ describe "object deletion" do
+ setup do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, op} = CommonAPI.post(other_user, %{status: "big oof"})
+ {:ok, post} = CommonAPI.post(user, %{status: "hey", in_reply_to_id: op})
+ {:ok, favorite} = CommonAPI.favorite(user, post.id)
+ object = Object.normalize(post)
+ {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
+ {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
+
+ %{
+ user: user,
+ delete: delete,
+ post: post,
+ object: object,
+ op: op,
+ favorite: favorite
+ }
+ end
+
+ test "it handles object deletions", %{
+ delete: delete,
+ post: post,
+ object: object,
+ user: user,
+ op: op,
+ favorite: favorite
+ } do
+ object_id = object.id
+ user_id = user.id
+
+ ActivityPubMock
+ |> expect(:stream_out, fn ^delete -> nil end)
+ |> expect(:stream_out_participations, fn %Object{id: ^object_id}, %User{id: ^user_id} ->
+ nil
+ end)
+
+ {:ok, _delete, _} = SideEffects.handle(delete)
+ user = User.get_cached_by_ap_id(object.data["actor"])
+
+ object = Object.get_by_id(object.id)
+ assert object.data["type"] == "Tombstone"
+ refute Activity.get_by_id(post.id)
+ refute Activity.get_by_id(favorite.id)
+
+ user = User.get_by_id(user.id)
+ assert user.note_count == 0
+
+ object = Object.normalize(op.data["object"], false)
+
+ assert object.data["repliesCount"] == 0
+ end
+
+ test "it handles object deletions when the object itself has been pruned", %{
+ delete: delete,
+ post: post,
+ object: object,
+ user: user,
+ op: op
+ } do
+ object_id = object.id
+ user_id = user.id
+
+ ActivityPubMock
+ |> expect(:stream_out, fn ^delete -> nil end)
+ |> expect(:stream_out_participations, fn %Object{id: ^object_id}, %User{id: ^user_id} ->
+ nil
+ end)
+
+ {:ok, _delete, _} = SideEffects.handle(delete)
+ user = User.get_cached_by_ap_id(object.data["actor"])
+
+ object = Object.get_by_id(object.id)
+ assert object.data["type"] == "Tombstone"
+ refute Activity.get_by_id(post.id)
+
+ user = User.get_by_id(user.id)
+ assert user.note_count == 0
+
+ object = Object.normalize(op.data["object"], false)
+
+ assert object.data["repliesCount"] == 0
+ end
+
+ test "it logs issues with objects deletion", %{
+ delete: delete,
+ object: object
+ } do
+ {:ok, _object} =
+ object
+ |> Object.change(%{data: Map.delete(object.data, "actor")})
+ |> Repo.update()
+
+ LoggerMock
+ |> expect(:error, fn str -> assert str =~ "The object doesn't have an actor" end)
+
+ {:error, :no_object_actor} = SideEffects.handle(delete)
+ end
+ end
+end
diff --git a/test/pleroma/web/activity_pub/side_effects_test.exs b/test/pleroma/web/activity_pub/side_effects_test.exs
index 9efbaad04..50af7a507 100644
--- a/test/pleroma/web/activity_pub/side_effects_test.exs
+++ b/test/pleroma/web/activity_pub/side_effects_test.exs
@@ -19,7 +19,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
alias Pleroma.Web.ActivityPub.SideEffects
alias Pleroma.Web.CommonAPI
- import ExUnit.CaptureLog
import Mock
import Pleroma.Factory
@@ -108,7 +107,7 @@ test "it blocks but does not unfollow if the relevant setting is set", %{
describe "update users" do
setup do
- user = insert(:user)
+ user = insert(:user, local: false)
{:ok, update_data, []} = Builder.update(user, %{"id" => user.ap_id, "name" => "new name!"})
{:ok, update, _meta} = ActivityPub.persist(update_data, local: true)
@@ -131,115 +130,6 @@ test "it uses a given changeset to update", %{user: user, update: update} do
end
end
- describe "delete objects" do
- setup do
- user = insert(:user)
- other_user = insert(:user)
-
- {:ok, op} = CommonAPI.post(other_user, %{status: "big oof"})
- {:ok, post} = CommonAPI.post(user, %{status: "hey", in_reply_to_id: op})
- {:ok, favorite} = CommonAPI.favorite(user, post.id)
- object = Object.normalize(post)
- {:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
- {:ok, delete_user_data, _meta} = Builder.delete(user, user.ap_id)
- {:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
- {:ok, delete_user, _meta} = ActivityPub.persist(delete_user_data, local: true)
-
- %{
- user: user,
- delete: delete,
- post: post,
- object: object,
- delete_user: delete_user,
- op: op,
- favorite: favorite
- }
- end
-
- test "it handles object deletions", %{
- delete: delete,
- post: post,
- object: object,
- user: user,
- op: op,
- favorite: favorite
- } do
- with_mock Pleroma.Web.ActivityPub.ActivityPub, [:passthrough],
- stream_out: fn _ -> nil end,
- stream_out_participations: fn _, _ -> nil end do
- {:ok, delete, _} = SideEffects.handle(delete)
- user = User.get_cached_by_ap_id(object.data["actor"])
-
- assert called(Pleroma.Web.ActivityPub.ActivityPub.stream_out(delete))
- assert called(Pleroma.Web.ActivityPub.ActivityPub.stream_out_participations(object, user))
- end
-
- object = Object.get_by_id(object.id)
- assert object.data["type"] == "Tombstone"
- refute Activity.get_by_id(post.id)
- refute Activity.get_by_id(favorite.id)
-
- user = User.get_by_id(user.id)
- assert user.note_count == 0
-
- object = Object.normalize(op.data["object"], false)
-
- assert object.data["repliesCount"] == 0
- end
-
- test "it handles object deletions when the object itself has been pruned", %{
- delete: delete,
- post: post,
- object: object,
- user: user,
- op: op
- } do
- with_mock Pleroma.Web.ActivityPub.ActivityPub, [:passthrough],
- stream_out: fn _ -> nil end,
- stream_out_participations: fn _, _ -> nil end do
- {:ok, delete, _} = SideEffects.handle(delete)
- user = User.get_cached_by_ap_id(object.data["actor"])
-
- assert called(Pleroma.Web.ActivityPub.ActivityPub.stream_out(delete))
- assert called(Pleroma.Web.ActivityPub.ActivityPub.stream_out_participations(object, user))
- end
-
- object = Object.get_by_id(object.id)
- assert object.data["type"] == "Tombstone"
- refute Activity.get_by_id(post.id)
-
- user = User.get_by_id(user.id)
- assert user.note_count == 0
-
- object = Object.normalize(op.data["object"], false)
-
- assert object.data["repliesCount"] == 0
- end
-
- test "it handles user deletions", %{delete_user: delete, user: user} do
- {:ok, _delete, _} = SideEffects.handle(delete)
- ObanHelpers.perform_all()
-
- assert User.get_cached_by_ap_id(user.ap_id).deactivated
- end
-
- test "it logs issues with objects deletion", %{
- delete: delete,
- object: object
- } do
- {:ok, object} =
- object
- |> Object.change(%{data: Map.delete(object.data, "actor")})
- |> Repo.update()
-
- Object.invalid_object_cache(object)
-
- assert capture_log(fn ->
- {:error, :no_object_actor} = SideEffects.handle(delete)
- end) =~ "object doesn't have an actor"
- end
- end
-
describe "EmojiReact objects" do
setup do
poster = insert(:user)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
index c6ff96f08..d356fcc72 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/accept_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.AcceptHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.User
alias Pleroma.Web.ActivityPub.Transmogrifier
@@ -15,14 +15,14 @@ test "it works for incoming accepts which were pre-accepted" do
follower = insert(:user)
followed = insert(:user)
- {:ok, follower} = User.follow(follower, followed)
+ {:ok, follower, followed} = User.follow(follower, followed)
assert User.following?(follower, followed) == true
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
object =
@@ -52,7 +52,7 @@ test "it works for incoming accepts which are referenced by IRI only" do
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
|> Map.put("object", follow_activity.data["id"])
@@ -76,7 +76,7 @@ test "it fails for incoming accepts which cannot be correlated" do
accept_data =
File.read!("test/fixtures/mastodon-accept-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
accept_data =
diff --git a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs
index 54335acdb..c06bbc5e9 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/announce_handling_test.exs
@@ -36,7 +36,7 @@ test "it works for incoming honk announces" do
end
test "it works for incoming announces with actor being inlined (kroeg)" do
- data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/kroeg-announce-with-inline-actor.json") |> Jason.decode!()
_user = insert(:user, local: false, ap_id: data["actor"]["id"])
other_user = insert(:user)
@@ -55,12 +55,16 @@ test "it works for incoming announces with actor being inlined (kroeg)" do
test "it works for incoming announces, fetching the announced object" do
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", "http://mastodon.example.org/users/admin/statuses/99541947525187367")
Tesla.Mock.mock(fn
%{method: :get} ->
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/mastodon-note-object.json")}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/mastodon-note-object.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
+ }
end)
_user = insert(:user, local: false, ap_id: data["actor"])
@@ -86,7 +90,7 @@ test "it works for incoming announces with an existing activity" do
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_user = insert(:user, local: false, ap_id: data["actor"])
@@ -109,7 +113,7 @@ test "it works for incoming announces with an existing activity" do
test "it works for incoming announces with an inlined activity" do
data =
File.read!("test/fixtures/mastodon-announce-private.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_user =
insert(:user,
@@ -140,7 +144,7 @@ test "it rejects incoming announces with an inlined activity from another origin
data =
File.read!("test/fixtures/bogus-mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_user = insert(:user, local: false, ap_id: data["actor"])
@@ -153,7 +157,7 @@ test "it does not clobber the addressing on announce activities" do
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", Object.normalize(activity).data["id"])
|> Map.put("to", ["http://mastodon.example.org/users/admin/followers"])
|> Map.put("cc", [])
diff --git a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs
index e7d85a2c5..a1c2ba28a 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/answer_handling_test.exs
@@ -31,7 +31,7 @@ test "incoming, rewrites Note to Answer and increments vote counters" do
data =
File.read!("test/fixtures/mastodon-vote.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["to"], user.ap_id)
|> Kernel.put_in(["object", "inReplyTo"], object.data["id"])
|> Kernel.put_in(["object", "to"], user.ap_id)
@@ -66,7 +66,7 @@ test "outgoing, rewrites Answer to Note" do
# TODO: Replace with CommonAPI vote creation when implemented
data =
File.read!("test/fixtures/mastodon-vote.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["to"], user.ap_id)
|> Kernel.put_in(["object", "inReplyTo"], poll_object.data["id"])
|> Kernel.put_in(["object", "to"], user.ap_id)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs
index 9b12a470a..b0ae804c5 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/article_handling_test.exs
@@ -13,7 +13,11 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.ArticleHandlingTest do
test "Pterotype (Wordpress Plugin) Article" do
Tesla.Mock.mock(fn %{url: "https://wedistribute.org/wp-json/pterotype/v1/actor/-blog"} ->
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json")}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
+ }
end)
data =
@@ -36,13 +40,15 @@ test "Plume Article" do
%{url: "https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-2018/"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-article.json")
+ body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-article.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
%{url: "https://baptiste.gelez.xyz/@/BaptisteGelez"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-user.json")
+ body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-user.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
end)
@@ -61,7 +67,8 @@ test "Prismo Article" do
Tesla.Mock.mock(fn %{url: "https://prismo.news/@mxb"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___prismo.news__mxb.json")
+ body: File.read!("test/fixtures/tesla_mock/https___prismo.news__mxb.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
end)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs
index 0636d00c5..7a2ac5d4d 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/audio_handling_test.exs
@@ -48,11 +48,12 @@ test "Funkwhale Audio object" do
%{url: "https://channels.tests.funkwhale.audio/federation/actors/compositions"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json")
+ body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
end)
- data = File.read!("test/fixtures/tesla_mock/funkwhale_create_audio.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/tesla_mock/funkwhale_create_audio.json") |> Jason.decode!()
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -69,6 +70,7 @@ test "Funkwhale Audio object" do
"mediaType" => "audio/ogg",
"type" => "Link",
"name" => nil,
+ "blurhash" => nil,
"url" => [
%{
"href" =>
diff --git a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs
index 71f1a0ed5..6adad88f5 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/block_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.BlockHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.User
@@ -16,7 +16,7 @@ test "it works for incoming blocks" do
data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
blocker = insert(:user, ap_id: data["actor"])
@@ -36,12 +36,12 @@ test "incoming blocks successfully tear down any follow relationship" do
data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", blocked.ap_id)
|> Map.put("actor", blocker.ap_id)
- {:ok, blocker} = User.follow(blocker, blocked)
- {:ok, blocked} = User.follow(blocked, blocker)
+ {:ok, blocker, blocked} = User.follow(blocker, blocked)
+ {:ok, blocked, blocker} = User.follow(blocked, blocker)
assert User.following?(blocker, blocked)
assert User.following?(blocked, blocker)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs
index 31274c067..2adaa1ade 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/chat_message_test.exs
@@ -53,7 +53,7 @@ test "handles chonks with attachment" do
test "it rejects messages that don't contain content" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
object =
data["object"]
@@ -79,7 +79,7 @@ test "it rejects messages that don't contain content" do
test "it rejects messages that don't concern local users" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_author =
insert(:user, ap_id: data["actor"], local: false, last_refreshed_at: DateTime.utc_now())
@@ -97,7 +97,7 @@ test "it rejects messages that don't concern local users" do
test "it rejects messages where the `to` field of activity and object don't match" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
author = insert(:user, ap_id: data["actor"])
_recipient = insert(:user, ap_id: List.first(data["to"]))
@@ -115,7 +115,7 @@ test "it fetches the actor if they aren't in our system" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", "http://mastodon.example.org/users/admin")
|> put_in(["object", "actor"], "http://mastodon.example.org/users/admin")
@@ -127,7 +127,7 @@ test "it fetches the actor if they aren't in our system" do
test "it doesn't work for deactivated users" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
_author =
insert(:user,
@@ -145,7 +145,7 @@ test "it doesn't work for deactivated users" do
test "it inserts it and creates a chat" do
data =
File.read!("test/fixtures/create-chat-message.json")
- |> Poison.decode!()
+ |> Jason.decode!()
author =
insert(:user, ap_id: data["actor"], local: false, last_refreshed_at: DateTime.utc_now())
diff --git a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs
index c9a53918c..1f9e73ff8 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/delete_handling_test.exs
@@ -25,7 +25,7 @@ test "it works for incoming deletes" do
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", deleting_user.ap_id)
|> put_in(["object", "id"], activity.data["object"])
@@ -51,13 +51,14 @@ test "it works for incoming when the object has been pruned" do
Object.normalize(activity.data["object"])
|> Repo.delete()
+ # TODO: mock cachex
Cachex.del(:object_cache, "object:#{object.data["id"]}")
deleting_user = insert(:user)
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", deleting_user.ap_id)
|> put_in(["object", "id"], activity.data["object"])
@@ -78,7 +79,7 @@ test "it fails for incoming deletes with spoofed origin" do
data =
File.read!("test/fixtures/mastodon-delete.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", ap_id)
|> put_in(["object", "id"], activity.data["object"])
@@ -91,7 +92,7 @@ test "it works for incoming user deletes" do
data =
File.read!("test/fixtures/mastodon-delete-user.json")
- |> Poison.decode!()
+ |> Jason.decode!()
{:ok, _} = Transmogrifier.handle_incoming(data)
ObanHelpers.perform_all()
@@ -104,7 +105,7 @@ test "it fails for incoming user deletes with spoofed origin" do
data =
File.read!("test/fixtures/mastodon-delete-user.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", ap_id)
assert match?({:error, _}, Transmogrifier.handle_incoming(data))
diff --git a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
index 0fb056b50..1ebf6b1e8 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/emoji_react_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.EmojiReactHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Object
@@ -19,7 +19,7 @@ test "it works for incoming emoji reactions" do
data =
File.read!("test/fixtures/emoji-reaction.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
@@ -44,7 +44,7 @@ test "it reject invalid emoji reactions" do
data =
File.read!("test/fixtures/emoji-reaction-too-long.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
@@ -52,7 +52,7 @@ test "it reject invalid emoji reactions" do
data =
File.read!("test/fixtures/emoji-reaction-no-emoji.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", other_user.ap_id)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs
index 7f1ef2cbd..d7c55cfbe 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/event_handling_test.exs
@@ -13,13 +13,15 @@ test "Mobilizon Event object" do
%{url: "https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json")
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
%{url: "https://mobilizon.org/@tcit"} ->
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json")
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json"),
+ headers: HttpRequestMock.activitypub_object_headers()
}
end)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
index 4ef8210ad..985c26def 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/follow_handling_test.exs
@@ -28,7 +28,7 @@ test "it works for osada follow request" do
data =
File.read!("test/fixtures/osada-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -47,7 +47,7 @@ test "it works for incoming follow requests" do
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -69,7 +69,7 @@ test "with locked accounts, it does create a Follow, but not an Accept" do
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
@@ -100,7 +100,7 @@ test "it works for follow requests when you are already followed, creating a new
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
@@ -116,7 +116,7 @@ test "it works for follow requests when you are already followed, creating a new
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("id", String.replace(data["id"], "2", "3"))
|> Map.put("object", user.ap_id)
@@ -142,7 +142,7 @@ test "it rejects incoming follow requests from blocked users when deny_follow_bl
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: %{"id" => id}}} = Transmogrifier.handle_incoming(data)
@@ -157,7 +157,7 @@ test "it rejects incoming follow requests if the following errors for some reaso
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
with_mock Pleroma.User, [:passthrough], follow: fn _, _, _ -> {:error, :testing} end do
@@ -174,7 +174,7 @@ test "it works for incoming follow requests from hubzilla" do
data =
File.read!("test/fixtures/hubzilla-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
|> Utils.normalize_params()
@@ -192,7 +192,7 @@ test "it works for incoming follows to locked account" do
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs
index 53fe1d550..35211b8f2 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/like_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.LikeHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Web.ActivityPub.Transmogrifier
@@ -18,7 +18,7 @@ test "it works for incoming likes" do
data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_actor = insert(:user, ap_id: data["actor"], local: false)
@@ -40,7 +40,7 @@ test "it works for incoming misskey likes, turning them into EmojiReacts" do
data =
File.read!("test/fixtures/misskey-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_actor = insert(:user, ap_id: data["actor"], local: false)
@@ -61,7 +61,7 @@ test "it works for incoming misskey likes that contain unicode emojis, turning t
data =
File.read!("test/fixtures/misskey-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("_misskey_reaction", "⭐")
diff --git a/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
new file mode 100644
index 000000000..b4a006aec
--- /dev/null
+++ b/test/pleroma/web/activity_pub/transmogrifier/note_handling_test.exs
@@ -0,0 +1,749 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
+ use Oban.Testing, repo: Pleroma.Repo
+ use Pleroma.DataCase
+
+ alias Pleroma.Activity
+ alias Pleroma.Object
+ alias Pleroma.User
+ alias Pleroma.Web.ActivityPub.Transmogrifier
+ alias Pleroma.Web.CommonAPI
+
+ import Mock
+ import Pleroma.Factory
+ import ExUnit.CaptureLog
+
+ setup_all do
+ Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ :ok
+ end
+
+ setup do: clear_config([:instance, :max_remote_account_fields])
+
+ describe "handle_incoming" do
+ test "it works for incoming notices with tag not being an array (kroeg)" do
+ data = File.read!("test/fixtures/kroeg-array-less-emoji.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+ object = Object.normalize(data["object"])
+
+ assert object.data["emoji"] == %{
+ "icon_e_smile" => "https://puckipedia.com/forum/images/smilies/icon_e_smile.png"
+ }
+
+ data = File.read!("test/fixtures/kroeg-array-less-hashtag.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+ object = Object.normalize(data["object"])
+
+ assert "test" in object.data["tag"]
+ end
+
+ test "it cleans up incoming notices which are not really DMs" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ to = [user.ap_id, other_user.ap_id]
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+ |> Map.put("to", to)
+ |> Map.put("cc", [])
+
+ object =
+ data["object"]
+ |> Map.put("to", to)
+ |> Map.put("cc", [])
+
+ data = Map.put(data, "object", object)
+
+ {:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
+
+ assert data["to"] == []
+ assert data["cc"] == to
+
+ object_data = Object.normalize(activity).data
+
+ assert object_data["to"] == []
+ assert object_data["cc"] == to
+ end
+
+ test "it ignores an incoming notice if we already have it" do
+ activity = insert(:note_activity)
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+ |> Map.put("object", Object.normalize(activity).data)
+
+ {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
+
+ assert activity == returned_activity
+ end
+
+ @tag capture_log: true
+ test "it fetches reply-to activities if we don't have them" do
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("inReplyTo", "https://mstdn.io/users/mayuutann/statuses/99568293732299394")
+
+ data = Map.put(data, "object", object)
+ {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
+ returned_object = Object.normalize(returned_activity, false)
+
+ assert %Activity{} =
+ Activity.get_create_by_object_ap_id(
+ "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
+ )
+
+ assert returned_object.data["inReplyTo"] ==
+ "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
+ end
+
+ test "it does not fetch reply-to activities beyond max replies depth limit" do
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
+
+ data = Map.put(data, "object", object)
+
+ with_mock Pleroma.Web.Federator,
+ allowed_thread_distance?: fn _ -> false end do
+ {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
+
+ returned_object = Object.normalize(returned_activity, false)
+
+ refute Activity.get_create_by_object_ap_id(
+ "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
+ )
+
+ assert returned_object.data["inReplyTo"] == "https://shitposter.club/notice/2827873"
+ end
+ end
+
+ test "it does not crash if the object in inReplyTo can't be fetched" do
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+
+ object =
+ data["object"]
+ |> Map.put("inReplyTo", "https://404.site/whatever")
+
+ data =
+ data
+ |> Map.put("object", object)
+
+ assert capture_log(fn ->
+ {:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
+ end) =~ "[warn] Couldn't fetch \"https://404.site/whatever\", error: nil"
+ end
+
+ test "it does not work for deactivated users" do
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
+
+ insert(:user, ap_id: data["actor"], deactivated: true)
+
+ assert {:error, _} = Transmogrifier.handle_incoming(data)
+ end
+
+ test "it works for incoming notices" do
+ data = File.read!("test/fixtures/mastodon-post-activity.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+
+ assert data["id"] ==
+ "http://mastodon.example.org/users/admin/statuses/99512778738411822/activity"
+
+ assert data["context"] ==
+ "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
+
+ assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
+
+ assert data["cc"] == [
+ "http://mastodon.example.org/users/admin/followers",
+ "http://localtesting.pleroma.lol/users/lain"
+ ]
+
+ assert data["actor"] == "http://mastodon.example.org/users/admin"
+
+ object_data = Object.normalize(data["object"]).data
+
+ assert object_data["id"] ==
+ "http://mastodon.example.org/users/admin/statuses/99512778738411822"
+
+ assert object_data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
+
+ assert object_data["cc"] == [
+ "http://mastodon.example.org/users/admin/followers",
+ "http://localtesting.pleroma.lol/users/lain"
+ ]
+
+ assert object_data["actor"] == "http://mastodon.example.org/users/admin"
+ assert object_data["attributedTo"] == "http://mastodon.example.org/users/admin"
+
+ assert object_data["context"] ==
+ "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
+
+ assert object_data["sensitive"] == true
+
+ user = User.get_cached_by_ap_id(object_data["actor"])
+
+ assert user.note_count == 1
+ end
+
+ test "it works for incoming notices without the sensitive property but an nsfw hashtag" do
+ data = File.read!("test/fixtures/mastodon-post-activity-nsfw.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+
+ object_data = Object.normalize(data["object"], false).data
+
+ assert object_data["sensitive"] == true
+ end
+
+ test "it works for incoming notices with hashtags" do
+ data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+ object = Object.normalize(data["object"])
+
+ assert Enum.at(object.data["tag"], 2) == "moo"
+ end
+
+ test "it works for incoming notices with contentMap" do
+ data = File.read!("test/fixtures/mastodon-post-activity-contentmap.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+ object = Object.normalize(data["object"])
+
+ assert object.data["content"] ==
+ "@lain
"
+ end
+
+ test "it works for incoming notices with to/cc not being an array (kroeg)" do
+ data = File.read!("test/fixtures/kroeg-post-activity.json") |> Jason.decode!()
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+ object = Object.normalize(data["object"])
+
+ assert object.data["content"] ==
+ "henlo from my Psion netBook
message sent from my Psion netBook
"
+ end
+
+ test "it ensures that as:Public activities make it to their followers collection" do
+ user = insert(:user)
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+ |> Map.put("actor", user.ap_id)
+ |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
+ |> Map.put("cc", [])
+
+ object =
+ data["object"]
+ |> Map.put("attributedTo", user.ap_id)
+ |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
+ |> Map.put("cc", [])
+ |> Map.put("id", user.ap_id <> "/activities/12345678")
+
+ data = Map.put(data, "object", object)
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+
+ assert data["cc"] == [User.ap_followers(user)]
+ end
+
+ test "it ensures that address fields become lists" do
+ user = insert(:user)
+
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+ |> Map.put("actor", user.ap_id)
+ |> Map.put("to", nil)
+ |> Map.put("cc", nil)
+
+ object =
+ data["object"]
+ |> Map.put("attributedTo", user.ap_id)
+ |> Map.put("to", nil)
+ |> Map.put("cc", nil)
+ |> Map.put("id", user.ap_id <> "/activities/12345678")
+
+ data = Map.put(data, "object", object)
+
+ {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+
+ assert !is_nil(data["to"])
+ assert !is_nil(data["cc"])
+ end
+
+ test "it strips internal likes" do
+ data =
+ File.read!("test/fixtures/mastodon-post-activity.json")
+ |> Jason.decode!()
+
+ likes = %{
+ "first" =>
+ "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes?page=1",
+ "id" => "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes",
+ "totalItems" => 3,
+ "type" => "OrderedCollection"
+ }
+
+ object = Map.put(data["object"], "likes", likes)
+ data = Map.put(data, "object", object)
+
+ {:ok, %Activity{object: object}} = Transmogrifier.handle_incoming(data)
+
+ refute Map.has_key?(object.data, "likes")
+ end
+
+ test "it strips internal reactions" do
+ user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "#cofe"})
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "📢")
+
+ %{object: object} = Activity.get_by_id_with_object(activity.id)
+ assert Map.has_key?(object.data, "reactions")
+ assert Map.has_key?(object.data, "reaction_count")
+
+ object_data = Transmogrifier.strip_internal_fields(object.data)
+ refute Map.has_key?(object_data, "reactions")
+ refute Map.has_key?(object_data, "reaction_count")
+ end
+
+ test "it correctly processes messages with non-array to field" do
+ user = insert(:user)
+
+ message = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "to" => "https://www.w3.org/ns/activitystreams#Public",
+ "type" => "Create",
+ "object" => %{
+ "content" => "blah blah blah",
+ "type" => "Note",
+ "attributedTo" => user.ap_id,
+ "inReplyTo" => nil
+ },
+ "actor" => user.ap_id
+ }
+
+ assert {:ok, activity} = Transmogrifier.handle_incoming(message)
+
+ assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["to"]
+ end
+
+ test "it correctly processes messages with non-array cc field" do
+ user = insert(:user)
+
+ message = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "to" => user.follower_address,
+ "cc" => "https://www.w3.org/ns/activitystreams#Public",
+ "type" => "Create",
+ "object" => %{
+ "content" => "blah blah blah",
+ "type" => "Note",
+ "attributedTo" => user.ap_id,
+ "inReplyTo" => nil
+ },
+ "actor" => user.ap_id
+ }
+
+ assert {:ok, activity} = Transmogrifier.handle_incoming(message)
+
+ assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"]
+ assert [user.follower_address] == activity.data["to"]
+ end
+
+ test "it correctly processes messages with weirdness in address fields" do
+ user = insert(:user)
+
+ message = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "to" => [nil, user.follower_address],
+ "cc" => ["https://www.w3.org/ns/activitystreams#Public", ["¿"]],
+ "type" => "Create",
+ "object" => %{
+ "content" => "…",
+ "type" => "Note",
+ "attributedTo" => user.ap_id,
+ "inReplyTo" => nil
+ },
+ "actor" => user.ap_id
+ }
+
+ assert {:ok, activity} = Transmogrifier.handle_incoming(message)
+
+ assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"]
+ assert [user.follower_address] == activity.data["to"]
+ end
+ end
+
+ describe "`handle_incoming/2`, Mastodon format `replies` handling" do
+ setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
+ setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
+
+ setup do
+ data =
+ "test/fixtures/mastodon-post-activity.json"
+ |> File.read!()
+ |> Jason.decode!()
+
+ items = get_in(data, ["object", "replies", "first", "items"])
+ assert length(items) > 0
+
+ %{data: data, items: items}
+ end
+
+ test "schedules background fetching of `replies` items if max thread depth limit allows", %{
+ data: data,
+ items: items
+ } do
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10)
+
+ {:ok, _activity} = Transmogrifier.handle_incoming(data)
+
+ for id <- items do
+ job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
+ assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
+ end
+ end
+
+ test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
+ %{data: data} do
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
+
+ {:ok, _activity} = Transmogrifier.handle_incoming(data)
+
+ assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
+ end
+ end
+
+ describe "`handle_incoming/2`, Pleroma format `replies` handling" do
+ setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
+ setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
+
+ setup do
+ user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{status: "post1"})
+
+ {:ok, reply1} =
+ CommonAPI.post(user, %{status: "reply1", in_reply_to_status_id: activity.id})
+
+ {:ok, reply2} =
+ CommonAPI.post(user, %{status: "reply2", in_reply_to_status_id: activity.id})
+
+ replies_uris = Enum.map([reply1, reply2], fn a -> a.object.data["id"] end)
+
+ {:ok, federation_output} = Transmogrifier.prepare_outgoing(activity.data)
+
+ Repo.delete(activity.object)
+ Repo.delete(activity)
+
+ %{federation_output: federation_output, replies_uris: replies_uris}
+ end
+
+ test "schedules background fetching of `replies` items if max thread depth limit allows", %{
+ federation_output: federation_output,
+ replies_uris: replies_uris
+ } do
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 1)
+
+ {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
+
+ for id <- replies_uris do
+ job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
+ assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
+ end
+ end
+
+ test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
+ %{federation_output: federation_output} do
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
+
+ {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
+
+ assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
+ end
+ end
+
+ describe "reserialization" do
+ test "successfully reserializes a message with inReplyTo == nil" do
+ user = insert(:user)
+
+ message = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "to" => ["https://www.w3.org/ns/activitystreams#Public"],
+ "cc" => [],
+ "type" => "Create",
+ "object" => %{
+ "to" => ["https://www.w3.org/ns/activitystreams#Public"],
+ "cc" => [],
+ "type" => "Note",
+ "content" => "Hi",
+ "inReplyTo" => nil,
+ "attributedTo" => user.ap_id
+ },
+ "actor" => user.ap_id
+ }
+
+ {:ok, activity} = Transmogrifier.handle_incoming(message)
+
+ {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
+ end
+
+ test "successfully reserializes a message with AS2 objects in IR" do
+ user = insert(:user)
+
+ message = %{
+ "@context" => "https://www.w3.org/ns/activitystreams",
+ "to" => ["https://www.w3.org/ns/activitystreams#Public"],
+ "cc" => [],
+ "type" => "Create",
+ "object" => %{
+ "to" => ["https://www.w3.org/ns/activitystreams#Public"],
+ "cc" => [],
+ "type" => "Note",
+ "content" => "Hi",
+ "inReplyTo" => nil,
+ "attributedTo" => user.ap_id,
+ "tag" => [
+ %{"name" => "#2hu", "href" => "http://example.com/2hu", "type" => "Hashtag"},
+ %{"name" => "Bob", "href" => "http://example.com/bob", "type" => "Mention"}
+ ]
+ },
+ "actor" => user.ap_id
+ }
+
+ {:ok, activity} = Transmogrifier.handle_incoming(message)
+
+ {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
+ end
+ end
+
+ describe "fix_in_reply_to/2" do
+ setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
+
+ setup do
+ data = Jason.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
+ [data: data]
+ end
+
+ test "returns not modified object when hasn't containts inReplyTo field", %{data: data} do
+ assert Transmogrifier.fix_in_reply_to(data) == data
+ end
+
+ test "returns object with inReplyTo when denied incoming reply", %{data: data} do
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
+
+ object_with_reply =
+ Map.put(data["object"], "inReplyTo", "https://shitposter.club/notice/2827873")
+
+ modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
+ assert modified_object["inReplyTo"] == "https://shitposter.club/notice/2827873"
+
+ object_with_reply =
+ Map.put(data["object"], "inReplyTo", %{"id" => "https://shitposter.club/notice/2827873"})
+
+ modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
+ assert modified_object["inReplyTo"] == %{"id" => "https://shitposter.club/notice/2827873"}
+
+ object_with_reply =
+ Map.put(data["object"], "inReplyTo", ["https://shitposter.club/notice/2827873"])
+
+ modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
+ assert modified_object["inReplyTo"] == ["https://shitposter.club/notice/2827873"]
+
+ object_with_reply = Map.put(data["object"], "inReplyTo", [])
+ modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
+ assert modified_object["inReplyTo"] == []
+ end
+
+ @tag capture_log: true
+ test "returns modified object when allowed incoming reply", %{data: data} do
+ object_with_reply =
+ Map.put(
+ data["object"],
+ "inReplyTo",
+ "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
+ )
+
+ Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 5)
+ modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
+
+ assert modified_object["inReplyTo"] ==
+ "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
+
+ assert modified_object["context"] ==
+ "tag:shitposter.club,2018-02-22:objectType=thread:nonce=e5a7c72d60a9c0e4"
+ end
+ end
+
+ describe "fix_attachments/1" do
+ test "returns not modified object" do
+ data = Jason.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
+ assert Transmogrifier.fix_attachments(data) == data
+ end
+
+ test "returns modified object when attachment is map" do
+ assert Transmogrifier.fix_attachments(%{
+ "attachment" => %{
+ "mediaType" => "video/mp4",
+ "url" => "https://peertube.moe/stat-480.mp4"
+ }
+ }) == %{
+ "attachment" => [
+ %{
+ "mediaType" => "video/mp4",
+ "type" => "Document",
+ "url" => [
+ %{
+ "href" => "https://peertube.moe/stat-480.mp4",
+ "mediaType" => "video/mp4",
+ "type" => "Link"
+ }
+ ]
+ }
+ ]
+ }
+ end
+
+ test "returns modified object when attachment is list" do
+ assert Transmogrifier.fix_attachments(%{
+ "attachment" => [
+ %{"mediaType" => "video/mp4", "url" => "https://pe.er/stat-480.mp4"},
+ %{"mimeType" => "video/mp4", "href" => "https://pe.er/stat-480.mp4"}
+ ]
+ }) == %{
+ "attachment" => [
+ %{
+ "mediaType" => "video/mp4",
+ "type" => "Document",
+ "url" => [
+ %{
+ "href" => "https://pe.er/stat-480.mp4",
+ "mediaType" => "video/mp4",
+ "type" => "Link"
+ }
+ ]
+ },
+ %{
+ "mediaType" => "video/mp4",
+ "type" => "Document",
+ "url" => [
+ %{
+ "href" => "https://pe.er/stat-480.mp4",
+ "mediaType" => "video/mp4",
+ "type" => "Link"
+ }
+ ]
+ }
+ ]
+ }
+ end
+ end
+
+ describe "fix_emoji/1" do
+ test "returns not modified object when object not contains tags" do
+ data = Jason.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
+ assert Transmogrifier.fix_emoji(data) == data
+ end
+
+ test "returns object with emoji when object contains list tags" do
+ assert Transmogrifier.fix_emoji(%{
+ "tag" => [
+ %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}},
+ %{"type" => "Hashtag"}
+ ]
+ }) == %{
+ "emoji" => %{"bib" => "/test"},
+ "tag" => [
+ %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"},
+ %{"type" => "Hashtag"}
+ ]
+ }
+ end
+
+ test "returns object with emoji when object contains map tag" do
+ assert Transmogrifier.fix_emoji(%{
+ "tag" => %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}}
+ }) == %{
+ "emoji" => %{"bib" => "/test"},
+ "tag" => %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"}
+ }
+ end
+ end
+
+ describe "set_replies/1" do
+ setup do: clear_config([:activitypub, :note_replies_output_limit], 2)
+
+ test "returns unmodified object if activity doesn't have self-replies" do
+ data = Jason.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
+ assert Transmogrifier.set_replies(data) == data
+ end
+
+ test "sets `replies` collection with a limited number of self-replies" do
+ [user, another_user] = insert_list(2, :user)
+
+ {:ok, %{id: id1} = activity} = CommonAPI.post(user, %{status: "1"})
+
+ {:ok, %{id: id2} = self_reply1} =
+ CommonAPI.post(user, %{status: "self-reply 1", in_reply_to_status_id: id1})
+
+ {:ok, self_reply2} =
+ CommonAPI.post(user, %{status: "self-reply 2", in_reply_to_status_id: id1})
+
+ # Assuming to _not_ be present in `replies` due to :note_replies_output_limit is set to 2
+ {:ok, _} = CommonAPI.post(user, %{status: "self-reply 3", in_reply_to_status_id: id1})
+
+ {:ok, _} =
+ CommonAPI.post(user, %{
+ status: "self-reply to self-reply",
+ in_reply_to_status_id: id2
+ })
+
+ {:ok, _} =
+ CommonAPI.post(another_user, %{
+ status: "another user's reply",
+ in_reply_to_status_id: id1
+ })
+
+ object = Object.normalize(activity)
+ replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end)
+
+ assert %{"type" => "Collection", "items" => ^replies_uris} =
+ Transmogrifier.set_replies(object.data)["replies"]
+ end
+ end
+
+ test "take_emoji_tags/1" do
+ user = insert(:user, %{emoji: %{"firefox" => "https://example.org/firefox.png"}})
+
+ assert Transmogrifier.take_emoji_tags(user) == [
+ %{
+ "icon" => %{"type" => "Image", "url" => "https://example.org/firefox.png"},
+ "id" => "https://example.org/firefox.png",
+ "name" => ":firefox:",
+ "type" => "Emoji",
+ "updated" => "1970-01-01T00:00:00Z"
+ }
+ ]
+ end
+end
diff --git a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs
index d2822ce75..47f92cf4d 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/question_handling_test.exs
@@ -18,7 +18,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.QuestionHandlingTest do
end
test "Mastodon Question activity" do
- data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-question-activity.json") |> Jason.decode!()
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -97,7 +97,7 @@ test "Mastodon Question activity with HTML tags in plaintext" do
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "oneOf"], options)
{:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -142,7 +142,7 @@ test "Mastodon Question activity with custom emojis" do
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "oneOf"], options)
|> Kernel.put_in(["object", "tag"], tag)
@@ -158,7 +158,7 @@ test "Mastodon Question activity with custom emojis" do
end
test "returns same activity if received a second time" do
- data = File.read!("test/fixtures/mastodon-question-activity.json") |> Poison.decode!()
+ data = File.read!("test/fixtures/mastodon-question-activity.json") |> Jason.decode!()
assert {:ok, %Activity{local: false} = activity} = Transmogrifier.handle_incoming(data)
@@ -168,7 +168,7 @@ test "returns same activity if received a second time" do
test "accepts a Question with no content" do
data =
File.read!("test/fixtures/mastodon-question-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Kernel.put_in(["object", "content"], "")
assert {:ok, %Activity{local: false}} = Transmogrifier.handle_incoming(data)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
index 5c1451def..851236758 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/reject_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.RejectHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.User
@@ -18,7 +18,7 @@ test "it fails for incoming rejects which cannot be correlated" do
accept_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
accept_data =
@@ -35,14 +35,14 @@ test "it works for incoming rejects which are referenced by IRI only" do
follower = insert(:user)
followed = insert(:user, is_locked: true)
- {:ok, follower} = User.follow(follower, followed)
+ {:ok, follower, followed} = User.follow(follower, followed)
{:ok, _, _, follow_activity} = CommonAPI.follow(follower, followed)
assert User.following?(follower, followed) == true
reject_data =
File.read!("test/fixtures/mastodon-reject-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", followed.ap_id)
|> Map.put("object", follow_activity.data["id"])
@@ -58,7 +58,7 @@ test "it rejects activities without a valid ID" do
data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
|> Map.put("id", "")
diff --git a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
index 8683f7135..107121ef8 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/undo_handling_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.Transmogrifier.UndoHandlingTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Object
@@ -21,7 +21,7 @@ test "it works for incoming emoji reaction undos" do
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", reaction_activity.data["id"])
|> Map.put("actor", user.ap_id)
@@ -38,7 +38,7 @@ test "it returns an error for incoming unlikes wihout a like activity" do
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
assert Transmogrifier.handle_incoming(data) == :error
@@ -50,7 +50,7 @@ test "it works for incoming unlikes with an existing like activity" do
like_data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_liker = insert(:user, ap_id: like_data["actor"], local: false)
@@ -59,7 +59,7 @@ test "it works for incoming unlikes with an existing like activity" do
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", like_data)
|> Map.put("actor", like_data["actor"])
@@ -81,7 +81,7 @@ test "it works for incoming unlikes with an existing like activity and a compact
like_data =
File.read!("test/fixtures/mastodon-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_liker = insert(:user, ap_id: like_data["actor"], local: false)
@@ -90,7 +90,7 @@ test "it works for incoming unlikes with an existing like activity and a compact
data =
File.read!("test/fixtures/mastodon-undo-like.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", like_data["id"])
|> Map.put("actor", like_data["actor"])
@@ -108,7 +108,7 @@ test "it works for incoming unannounces with an existing notice" do
announce_data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
_announcer = insert(:user, ap_id: announce_data["actor"], local: false)
@@ -118,7 +118,7 @@ test "it works for incoming unannounces with an existing notice" do
data =
File.read!("test/fixtures/mastodon-undo-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", announce_data)
|> Map.put("actor", announce_data["actor"])
@@ -135,7 +135,7 @@ test "it works for incoming unfollows with an existing follow" do
follow_data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
_follower = insert(:user, ap_id: follow_data["actor"], local: false)
@@ -144,7 +144,7 @@ test "it works for incoming unfollows with an existing follow" do
data =
File.read!("test/fixtures/mastodon-unfollow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", follow_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
@@ -162,7 +162,7 @@ test "it works for incoming unblocks with an existing block" do
block_data =
File.read!("test/fixtures/mastodon-block-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
_blocker = insert(:user, ap_id: block_data["actor"], local: false)
@@ -171,7 +171,7 @@ test "it works for incoming unblocks with an existing block" do
data =
File.read!("test/fixtures/mastodon-unblock-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", block_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
diff --git a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
index 7c4d16db7..8ed5e5e90 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/user_update_handling_test.exs
@@ -14,7 +14,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.UserUpdateHandlingTest do
test "it works for incoming update activities" do
user = insert(:user, local: false)
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
@@ -58,7 +58,7 @@ test "it works with alsoKnownAs" do
{:ok, _activity} =
"test/fixtures/mastodon-update.json"
|> File.read!()
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("actor", actor)
|> Map.update!("object", fn object ->
object
@@ -82,7 +82,7 @@ test "it works with custom profile fields" do
assert user.fields == []
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
@@ -103,7 +103,7 @@ test "it works with custom profile fields" do
%{"name" => "foo1", "value" => "updated"}
]
- Pleroma.Config.put([:instance, :max_remote_account_fields], 2)
+ clear_config([:instance, :max_remote_account_fields], 2)
update_data =
update_data
@@ -138,7 +138,7 @@ test "it works with custom profile fields" do
test "it works for incoming update activities which lock the account" do
user = insert(:user, local: false)
- update_data = File.read!("test/fixtures/mastodon-update.json") |> Poison.decode!()
+ update_data = File.read!("test/fixtures/mastodon-update.json") |> Jason.decode!()
object =
update_data["object"]
diff --git a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs
index 69c953a2e..57411fafa 100644
--- a/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier/video_handling_test.exs
@@ -54,6 +54,7 @@ test "it remaps video URLs as attachments if necessary" do
"type" => "Link",
"mediaType" => "video/mp4",
"name" => nil,
+ "blurhash" => nil,
"url" => [
%{
"href" =>
@@ -76,6 +77,7 @@ test "it remaps video URLs as attachments if necessary" do
"type" => "Link",
"mediaType" => "video/mp4",
"name" => nil,
+ "blurhash" => nil,
"url" => [
%{
"href" =>
diff --git a/test/pleroma/web/activity_pub/transmogrifier_test.exs b/test/pleroma/web/activity_pub/transmogrifier_test.exs
index e39af1dfc..aa32ebaab 100644
--- a/test/pleroma/web/activity_pub/transmogrifier_test.exs
+++ b/test/pleroma/web/activity_pub/transmogrifier_test.exs
@@ -26,323 +26,19 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
setup do: clear_config([:instance, :max_remote_account_fields])
describe "handle_incoming" do
- test "it works for incoming notices with tag not being an array (kroeg)" do
- data = File.read!("test/fixtures/kroeg-array-less-emoji.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
- object = Object.normalize(data["object"])
-
- assert object.data["emoji"] == %{
- "icon_e_smile" => "https://puckipedia.com/forum/images/smilies/icon_e_smile.png"
- }
-
- data = File.read!("test/fixtures/kroeg-array-less-hashtag.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
- object = Object.normalize(data["object"])
-
- assert "test" in object.data["tag"]
- end
-
- test "it cleans up incoming notices which are not really DMs" do
- user = insert(:user)
- other_user = insert(:user)
-
- to = [user.ap_id, other_user.ap_id]
-
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
- |> Map.put("to", to)
- |> Map.put("cc", [])
-
- object =
- data["object"]
- |> Map.put("to", to)
- |> Map.put("cc", [])
-
- data = Map.put(data, "object", object)
-
- {:ok, %Activity{data: data, local: false} = activity} = Transmogrifier.handle_incoming(data)
-
- assert data["to"] == []
- assert data["cc"] == to
-
- object_data = Object.normalize(activity).data
-
- assert object_data["to"] == []
- assert object_data["cc"] == to
- end
-
- test "it ignores an incoming notice if we already have it" do
- activity = insert(:note_activity)
-
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
- |> Map.put("object", Object.normalize(activity).data)
-
- {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
-
- assert activity == returned_activity
- end
-
- @tag capture_log: true
- test "it fetches reply-to activities if we don't have them" do
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
-
- object =
- data["object"]
- |> Map.put("inReplyTo", "https://mstdn.io/users/mayuutann/statuses/99568293732299394")
-
- data = Map.put(data, "object", object)
- {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
- returned_object = Object.normalize(returned_activity, false)
-
- assert %Activity{} =
- Activity.get_create_by_object_ap_id(
- "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
- )
-
- assert returned_object.data["inReplyTo"] ==
- "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
- end
-
- test "it does not fetch reply-to activities beyond max replies depth limit" do
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
-
- object =
- data["object"]
- |> Map.put("inReplyTo", "https://shitposter.club/notice/2827873")
-
- data = Map.put(data, "object", object)
-
- with_mock Pleroma.Web.Federator,
- allowed_thread_distance?: fn _ -> false end do
- {:ok, returned_activity} = Transmogrifier.handle_incoming(data)
-
- returned_object = Object.normalize(returned_activity, false)
-
- refute Activity.get_create_by_object_ap_id(
- "tag:shitposter.club,2017-05-05:noticeId=2827873:objectType=comment"
- )
-
- assert returned_object.data["inReplyTo"] == "https://shitposter.club/notice/2827873"
- end
- end
-
- test "it does not crash if the object in inReplyTo can't be fetched" do
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
-
- object =
- data["object"]
- |> Map.put("inReplyTo", "https://404.site/whatever")
-
- data =
- data
- |> Map.put("object", object)
-
- assert capture_log(fn ->
- {:ok, _returned_activity} = Transmogrifier.handle_incoming(data)
- end) =~ "[warn] Couldn't fetch \"https://404.site/whatever\", error: nil"
- end
-
- test "it does not work for deactivated users" do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
-
- insert(:user, ap_id: data["actor"], deactivated: true)
-
- assert {:error, _} = Transmogrifier.handle_incoming(data)
- end
-
- test "it works for incoming notices" do
- data = File.read!("test/fixtures/mastodon-post-activity.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
-
- assert data["id"] ==
- "http://mastodon.example.org/users/admin/statuses/99512778738411822/activity"
-
- assert data["context"] ==
- "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
-
- assert data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
-
- assert data["cc"] == [
- "http://mastodon.example.org/users/admin/followers",
- "http://localtesting.pleroma.lol/users/lain"
- ]
-
- assert data["actor"] == "http://mastodon.example.org/users/admin"
-
- object_data = Object.normalize(data["object"]).data
-
- assert object_data["id"] ==
- "http://mastodon.example.org/users/admin/statuses/99512778738411822"
-
- assert object_data["to"] == ["https://www.w3.org/ns/activitystreams#Public"]
-
- assert object_data["cc"] == [
- "http://mastodon.example.org/users/admin/followers",
- "http://localtesting.pleroma.lol/users/lain"
- ]
-
- assert object_data["actor"] == "http://mastodon.example.org/users/admin"
- assert object_data["attributedTo"] == "http://mastodon.example.org/users/admin"
-
- assert object_data["context"] ==
- "tag:mastodon.example.org,2018-02-12:objectId=20:objectType=Conversation"
-
- assert object_data["sensitive"] == true
-
- user = User.get_cached_by_ap_id(object_data["actor"])
-
- assert user.note_count == 1
- end
-
- test "it works for incoming notices without the sensitive property but an nsfw hashtag" do
- data = File.read!("test/fixtures/mastodon-post-activity-nsfw.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
-
- object_data = Object.normalize(data["object"], false).data
-
- assert object_data["sensitive"] == true
- end
-
- test "it works for incoming notices with hashtags" do
- data = File.read!("test/fixtures/mastodon-post-activity-hashtag.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
- object = Object.normalize(data["object"])
-
- assert Enum.at(object.data["tag"], 2) == "moo"
- end
-
- test "it works for incoming notices with contentMap" do
- data =
- File.read!("test/fixtures/mastodon-post-activity-contentmap.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
- object = Object.normalize(data["object"])
-
- assert object.data["content"] ==
- "@lain
"
- end
-
- test "it works for incoming notices with to/cc not being an array (kroeg)" do
- data = File.read!("test/fixtures/kroeg-post-activity.json") |> Poison.decode!()
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
- object = Object.normalize(data["object"])
-
- assert object.data["content"] ==
- "henlo from my Psion netBook
message sent from my Psion netBook
"
- end
-
- test "it ensures that as:Public activities make it to their followers collection" do
- user = insert(:user)
-
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
- |> Map.put("actor", user.ap_id)
- |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
- |> Map.put("cc", [])
-
- object =
- data["object"]
- |> Map.put("attributedTo", user.ap_id)
- |> Map.put("to", ["https://www.w3.org/ns/activitystreams#Public"])
- |> Map.put("cc", [])
- |> Map.put("id", user.ap_id <> "/activities/12345678")
-
- data = Map.put(data, "object", object)
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
-
- assert data["cc"] == [User.ap_followers(user)]
- end
-
- test "it ensures that address fields become lists" do
- user = insert(:user)
-
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
- |> Map.put("actor", user.ap_id)
- |> Map.put("to", nil)
- |> Map.put("cc", nil)
-
- object =
- data["object"]
- |> Map.put("attributedTo", user.ap_id)
- |> Map.put("to", nil)
- |> Map.put("cc", nil)
- |> Map.put("id", user.ap_id <> "/activities/12345678")
-
- data = Map.put(data, "object", object)
-
- {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
-
- assert !is_nil(data["to"])
- assert !is_nil(data["cc"])
- end
-
- test "it strips internal likes" do
- data =
- File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
-
- likes = %{
- "first" =>
- "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes?page=1",
- "id" => "http://mastodon.example.org/objects/dbdbc507-52c8-490d-9b7c-1e1d52e5c132/likes",
- "totalItems" => 3,
- "type" => "OrderedCollection"
- }
-
- object = Map.put(data["object"], "likes", likes)
- data = Map.put(data, "object", object)
-
- {:ok, %Activity{object: object}} = Transmogrifier.handle_incoming(data)
-
- refute Map.has_key?(object.data, "likes")
- end
-
- test "it strips internal reactions" do
- user = insert(:user)
- {:ok, activity} = CommonAPI.post(user, %{status: "#cofe"})
- {:ok, _} = CommonAPI.react_with_emoji(activity.id, user, "📢")
-
- %{object: object} = Activity.get_by_id_with_object(activity.id)
- assert Map.has_key?(object.data, "reactions")
- assert Map.has_key?(object.data, "reaction_count")
-
- object_data = Transmogrifier.strip_internal_fields(object.data)
- refute Map.has_key?(object_data, "reactions")
- refute Map.has_key?(object_data, "reaction_count")
- end
-
test "it works for incoming unfollows with an existing follow" do
user = insert(:user)
follow_data =
File.read!("test/fixtures/mastodon-follow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", user.ap_id)
{:ok, %Activity{data: _, local: false}} = Transmogrifier.handle_incoming(follow_data)
data =
File.read!("test/fixtures/mastodon-unfollow-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", follow_data)
{:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
@@ -387,73 +83,6 @@ test "it accepts Flag activities" do
assert activity.data["cc"] == [user.ap_id]
end
- test "it correctly processes messages with non-array to field" do
- user = insert(:user)
-
- message = %{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "to" => "https://www.w3.org/ns/activitystreams#Public",
- "type" => "Create",
- "object" => %{
- "content" => "blah blah blah",
- "type" => "Note",
- "attributedTo" => user.ap_id,
- "inReplyTo" => nil
- },
- "actor" => user.ap_id
- }
-
- assert {:ok, activity} = Transmogrifier.handle_incoming(message)
-
- assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["to"]
- end
-
- test "it correctly processes messages with non-array cc field" do
- user = insert(:user)
-
- message = %{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "to" => user.follower_address,
- "cc" => "https://www.w3.org/ns/activitystreams#Public",
- "type" => "Create",
- "object" => %{
- "content" => "blah blah blah",
- "type" => "Note",
- "attributedTo" => user.ap_id,
- "inReplyTo" => nil
- },
- "actor" => user.ap_id
- }
-
- assert {:ok, activity} = Transmogrifier.handle_incoming(message)
-
- assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"]
- assert [user.follower_address] == activity.data["to"]
- end
-
- test "it correctly processes messages with weirdness in address fields" do
- user = insert(:user)
-
- message = %{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "to" => [nil, user.follower_address],
- "cc" => ["https://www.w3.org/ns/activitystreams#Public", ["¿"]],
- "type" => "Create",
- "object" => %{
- "content" => "…",
- "type" => "Note",
- "attributedTo" => user.ap_id,
- "inReplyTo" => nil
- },
- "actor" => user.ap_id
- }
-
- assert {:ok, activity} = Transmogrifier.handle_incoming(message)
-
- assert ["https://www.w3.org/ns/activitystreams#Public"] == activity.data["cc"]
- assert [user.follower_address] == activity.data["to"]
- end
-
test "it accepts Move activities" do
old_user = insert(:user)
new_user = insert(:user)
@@ -479,95 +108,6 @@ test "it accepts Move activities" do
end
end
- describe "`handle_incoming/2`, Mastodon format `replies` handling" do
- setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
- setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
-
- setup do
- data =
- "test/fixtures/mastodon-post-activity.json"
- |> File.read!()
- |> Poison.decode!()
-
- items = get_in(data, ["object", "replies", "first", "items"])
- assert length(items) > 0
-
- %{data: data, items: items}
- end
-
- test "schedules background fetching of `replies` items if max thread depth limit allows", %{
- data: data,
- items: items
- } do
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 10)
-
- {:ok, _activity} = Transmogrifier.handle_incoming(data)
-
- for id <- items do
- job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
- assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
- end
- end
-
- test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
- %{data: data} do
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
-
- {:ok, _activity} = Transmogrifier.handle_incoming(data)
-
- assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
- end
- end
-
- describe "`handle_incoming/2`, Pleroma format `replies` handling" do
- setup do: clear_config([:activitypub, :note_replies_output_limit], 5)
- setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
-
- setup do
- user = insert(:user)
-
- {:ok, activity} = CommonAPI.post(user, %{status: "post1"})
-
- {:ok, reply1} =
- CommonAPI.post(user, %{status: "reply1", in_reply_to_status_id: activity.id})
-
- {:ok, reply2} =
- CommonAPI.post(user, %{status: "reply2", in_reply_to_status_id: activity.id})
-
- replies_uris = Enum.map([reply1, reply2], fn a -> a.object.data["id"] end)
-
- {:ok, federation_output} = Transmogrifier.prepare_outgoing(activity.data)
-
- Repo.delete(activity.object)
- Repo.delete(activity)
-
- %{federation_output: federation_output, replies_uris: replies_uris}
- end
-
- test "schedules background fetching of `replies` items if max thread depth limit allows", %{
- federation_output: federation_output,
- replies_uris: replies_uris
- } do
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 1)
-
- {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
-
- for id <- replies_uris do
- job_args = %{"op" => "fetch_remote", "id" => id, "depth" => 1}
- assert_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker, args: job_args)
- end
- end
-
- test "does NOT schedule background fetching of `replies` beyond max thread depth limit allows",
- %{federation_output: federation_output} do
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
-
- {:ok, _activity} = Transmogrifier.handle_incoming(federation_output)
-
- assert all_enqueued(worker: Pleroma.Workers.RemoteFetcherWorker) == []
- end
- end
-
describe "prepare outgoing" do
test "it inlines private announced objects" do
user = insert(:user)
@@ -741,6 +281,21 @@ test "it can handle Listen activities" do
{:ok, _modified} = Transmogrifier.prepare_outgoing(activity.data)
end
+
+ test "custom emoji urls are URI encoded" do
+ # :dinosaur: filename has a space -> dino walking.gif
+ user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{status: "everybody do the dinosaur :dinosaur:"})
+
+ {:ok, prepared} = Transmogrifier.prepare_outgoing(activity.data)
+
+ assert length(prepared["object"]["tag"]) == 1
+
+ url = prepared["object"]["tag"] |> List.first() |> Map.get("icon") |> Map.get("url")
+
+ assert url == "http://localhost:4001/emoji/dino%20walking.gif"
+ end
end
describe "user upgrade" do
@@ -864,60 +419,6 @@ test "it rejects activities which reference objects that have an incorrect attri
end
end
- describe "reserialization" do
- test "successfully reserializes a message with inReplyTo == nil" do
- user = insert(:user)
-
- message = %{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "to" => ["https://www.w3.org/ns/activitystreams#Public"],
- "cc" => [],
- "type" => "Create",
- "object" => %{
- "to" => ["https://www.w3.org/ns/activitystreams#Public"],
- "cc" => [],
- "type" => "Note",
- "content" => "Hi",
- "inReplyTo" => nil,
- "attributedTo" => user.ap_id
- },
- "actor" => user.ap_id
- }
-
- {:ok, activity} = Transmogrifier.handle_incoming(message)
-
- {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
- end
-
- test "successfully reserializes a message with AS2 objects in IR" do
- user = insert(:user)
-
- message = %{
- "@context" => "https://www.w3.org/ns/activitystreams",
- "to" => ["https://www.w3.org/ns/activitystreams#Public"],
- "cc" => [],
- "type" => "Create",
- "object" => %{
- "to" => ["https://www.w3.org/ns/activitystreams#Public"],
- "cc" => [],
- "type" => "Note",
- "content" => "Hi",
- "inReplyTo" => nil,
- "attributedTo" => user.ap_id,
- "tag" => [
- %{"name" => "#2hu", "href" => "http://example.com/2hu", "type" => "Hashtag"},
- %{"name" => "Bob", "href" => "http://example.com/bob", "type" => "Mention"}
- ]
- },
- "actor" => user.ap_id
- }
-
- {:ok, activity} = Transmogrifier.handle_incoming(message)
-
- {:ok, _} = Transmogrifier.prepare_outgoing(activity.data)
- end
- end
-
describe "fix_explicit_addressing" do
setup do
user = insert(:user)
@@ -983,64 +484,6 @@ test "returns fixed object" do
end
end
- describe "fix_in_reply_to/2" do
- setup do: clear_config([:instance, :federation_incoming_replies_max_depth])
-
- setup do
- data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
- [data: data]
- end
-
- test "returns not modified object when hasn't containts inReplyTo field", %{data: data} do
- assert Transmogrifier.fix_in_reply_to(data) == data
- end
-
- test "returns object with inReplyTo when denied incoming reply", %{data: data} do
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 0)
-
- object_with_reply =
- Map.put(data["object"], "inReplyTo", "https://shitposter.club/notice/2827873")
-
- modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
- assert modified_object["inReplyTo"] == "https://shitposter.club/notice/2827873"
-
- object_with_reply =
- Map.put(data["object"], "inReplyTo", %{"id" => "https://shitposter.club/notice/2827873"})
-
- modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
- assert modified_object["inReplyTo"] == %{"id" => "https://shitposter.club/notice/2827873"}
-
- object_with_reply =
- Map.put(data["object"], "inReplyTo", ["https://shitposter.club/notice/2827873"])
-
- modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
- assert modified_object["inReplyTo"] == ["https://shitposter.club/notice/2827873"]
-
- object_with_reply = Map.put(data["object"], "inReplyTo", [])
- modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
- assert modified_object["inReplyTo"] == []
- end
-
- @tag capture_log: true
- test "returns modified object when allowed incoming reply", %{data: data} do
- object_with_reply =
- Map.put(
- data["object"],
- "inReplyTo",
- "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
- )
-
- Pleroma.Config.put([:instance, :federation_incoming_replies_max_depth], 5)
- modified_object = Transmogrifier.fix_in_reply_to(object_with_reply)
-
- assert modified_object["inReplyTo"] ==
- "https://mstdn.io/users/mayuutann/statuses/99568293732299394"
-
- assert modified_object["context"] ==
- "tag:shitposter.club,2018-02-22:objectType=thread:nonce=e5a7c72d60a9c0e4"
- end
- end
-
describe "fix_url/1" do
test "fixes data for object when url is map" do
object = %{
@@ -1076,155 +519,4 @@ test "returns {:ok, %Object{}} for success case" do
)
end
end
-
- describe "fix_attachments/1" do
- test "returns not modified object" do
- data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
- assert Transmogrifier.fix_attachments(data) == data
- end
-
- test "returns modified object when attachment is map" do
- assert Transmogrifier.fix_attachments(%{
- "attachment" => %{
- "mediaType" => "video/mp4",
- "url" => "https://peertube.moe/stat-480.mp4"
- }
- }) == %{
- "attachment" => [
- %{
- "mediaType" => "video/mp4",
- "type" => "Document",
- "url" => [
- %{
- "href" => "https://peertube.moe/stat-480.mp4",
- "mediaType" => "video/mp4",
- "type" => "Link"
- }
- ]
- }
- ]
- }
- end
-
- test "returns modified object when attachment is list" do
- assert Transmogrifier.fix_attachments(%{
- "attachment" => [
- %{"mediaType" => "video/mp4", "url" => "https://pe.er/stat-480.mp4"},
- %{"mimeType" => "video/mp4", "href" => "https://pe.er/stat-480.mp4"}
- ]
- }) == %{
- "attachment" => [
- %{
- "mediaType" => "video/mp4",
- "type" => "Document",
- "url" => [
- %{
- "href" => "https://pe.er/stat-480.mp4",
- "mediaType" => "video/mp4",
- "type" => "Link"
- }
- ]
- },
- %{
- "mediaType" => "video/mp4",
- "type" => "Document",
- "url" => [
- %{
- "href" => "https://pe.er/stat-480.mp4",
- "mediaType" => "video/mp4",
- "type" => "Link"
- }
- ]
- }
- ]
- }
- end
- end
-
- describe "fix_emoji/1" do
- test "returns not modified object when object not contains tags" do
- data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
- assert Transmogrifier.fix_emoji(data) == data
- end
-
- test "returns object with emoji when object contains list tags" do
- assert Transmogrifier.fix_emoji(%{
- "tag" => [
- %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}},
- %{"type" => "Hashtag"}
- ]
- }) == %{
- "emoji" => %{"bib" => "/test"},
- "tag" => [
- %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"},
- %{"type" => "Hashtag"}
- ]
- }
- end
-
- test "returns object with emoji when object contains map tag" do
- assert Transmogrifier.fix_emoji(%{
- "tag" => %{"type" => "Emoji", "name" => ":bib:", "icon" => %{"url" => "/test"}}
- }) == %{
- "emoji" => %{"bib" => "/test"},
- "tag" => %{"icon" => %{"url" => "/test"}, "name" => ":bib:", "type" => "Emoji"}
- }
- end
- end
-
- describe "set_replies/1" do
- setup do: clear_config([:activitypub, :note_replies_output_limit], 2)
-
- test "returns unmodified object if activity doesn't have self-replies" do
- data = Poison.decode!(File.read!("test/fixtures/mastodon-post-activity.json"))
- assert Transmogrifier.set_replies(data) == data
- end
-
- test "sets `replies` collection with a limited number of self-replies" do
- [user, another_user] = insert_list(2, :user)
-
- {:ok, %{id: id1} = activity} = CommonAPI.post(user, %{status: "1"})
-
- {:ok, %{id: id2} = self_reply1} =
- CommonAPI.post(user, %{status: "self-reply 1", in_reply_to_status_id: id1})
-
- {:ok, self_reply2} =
- CommonAPI.post(user, %{status: "self-reply 2", in_reply_to_status_id: id1})
-
- # Assuming to _not_ be present in `replies` due to :note_replies_output_limit is set to 2
- {:ok, _} = CommonAPI.post(user, %{status: "self-reply 3", in_reply_to_status_id: id1})
-
- {:ok, _} =
- CommonAPI.post(user, %{
- status: "self-reply to self-reply",
- in_reply_to_status_id: id2
- })
-
- {:ok, _} =
- CommonAPI.post(another_user, %{
- status: "another user's reply",
- in_reply_to_status_id: id1
- })
-
- object = Object.normalize(activity)
- replies_uris = Enum.map([self_reply1, self_reply2], fn a -> a.object.data["id"] end)
-
- assert %{"type" => "Collection", "items" => ^replies_uris} =
- Transmogrifier.set_replies(object.data)["replies"]
- end
- end
-
- test "take_emoji_tags/1" do
- user = insert(:user, %{emoji: %{"firefox" => "https://example.org/firefox.png"}})
-
- assert Transmogrifier.take_emoji_tags(user) == [
- %{
- "icon" => %{"type" => "Image", "url" => "https://example.org/firefox.png"},
- "id" => "https://example.org/firefox.png",
- "name" => ":firefox:",
- "type" => "Emoji",
- "updated" => "1970-01-01T00:00:00Z"
- }
- ]
- end
end
diff --git a/test/pleroma/web/activity_pub/utils_test.exs b/test/pleroma/web/activity_pub/utils_test.exs
index be9cd7d13..2263b6091 100644
--- a/test/pleroma/web/activity_pub/utils_test.exs
+++ b/test/pleroma/web/activity_pub/utils_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.UtilsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Object
alias Pleroma.Repo
diff --git a/test/pleroma/web/activity_pub/views/user_view_test.exs b/test/pleroma/web/activity_pub/views/user_view_test.exs
index 98c7c9d09..5702c1b6f 100644
--- a/test/pleroma/web/activity_pub/views/user_view_test.exs
+++ b/test/pleroma/web/activity_pub/views/user_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.UserViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.User
@@ -80,6 +80,12 @@ test "renders an invisible user with the invisible property set to true" do
assert %{"invisible" => true} = UserView.render("service.json", %{user: user})
end
+ test "renders AKAs" do
+ akas = ["https://i.tusooa.xyz/users/test-pleroma"]
+ user = insert(:user, also_known_as: akas)
+ assert %{"alsoKnownAs" => ^akas} = UserView.render("user.json", %{user: user})
+ end
+
describe "endpoints" do
test "local users have a usable endpoints structure" do
user = insert(:user)
diff --git a/test/pleroma/web/activity_pub/visibility_test.exs b/test/pleroma/web/activity_pub/visibility_test.exs
index 8e9354c65..1ec41aa19 100644
--- a/test/pleroma/web/activity_pub/visibility_test.exs
+++ b/test/pleroma/web/activity_pub/visibility_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.ActivityPub.VisibilityTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Web.ActivityPub.Visibility
@@ -15,7 +15,7 @@ defmodule Pleroma.Web.ActivityPub.VisibilityTest do
mentioned = insert(:user)
following = insert(:user)
unrelated = insert(:user)
- {:ok, following} = Pleroma.User.follow(following, user)
+ {:ok, following, user} = Pleroma.User.follow(following, user)
{:ok, list} = Pleroma.List.create("foo", user)
Pleroma.List.follow(list, unrelated)
@@ -159,7 +159,7 @@ test "doesn't die when the user doesn't exist",
user: user
} do
Repo.delete(user)
- Cachex.clear(:user_cache)
+ Pleroma.User.invalidate_cache(user)
refute Visibility.is_private?(direct)
end
diff --git a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
index c06ae55ca..90b25b782 100644
--- a/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/admin_api_controller_test.exs
@@ -422,10 +422,20 @@ test "renders user's statuses", %{conn: conn, user: user} do
assert json_response(conn, 200) |> length() == 3
end
- test "renders user's statuses with a limit", %{conn: conn, user: user} do
- conn = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=2")
+ test "renders user's statuses with pagination", %{conn: conn, user: user} do
+ conn1 = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=1")
- assert json_response(conn, 200) |> length() == 2
+ response1 = json_response(conn1, 200)
+
+ assert response1 |> length() == 1
+
+ conn2 = get(conn, "/api/pleroma/admin/users/#{user.nickname}/statuses?page_size=1&page=2")
+
+ response2 = json_response(conn2, 200)
+
+ assert response2 |> length() == 1
+
+ refute response1 == response2
end
test "doesn't return private statuses by default", %{conn: conn, user: user} do
@@ -941,7 +951,6 @@ test "it resend emails for two users", %{conn: conn, admin: admin} do
describe "/api/pleroma/admin/stats" do
test "status visibility count", %{conn: conn} do
- admin = insert(:user, is_admin: true)
user = insert(:user)
CommonAPI.post(user, %{visibility: "public", status: "hey"})
CommonAPI.post(user, %{visibility: "unlisted", status: "hey"})
@@ -949,7 +958,6 @@ test "status visibility count", %{conn: conn} do
response =
conn
- |> assign(:user, admin)
|> get("/api/pleroma/admin/stats")
|> json_response(200)
@@ -958,7 +966,6 @@ test "status visibility count", %{conn: conn} do
end
test "by instance", %{conn: conn} do
- admin = insert(:user, is_admin: true)
user1 = insert(:user)
instance2 = "instance2.tld"
user2 = insert(:user, %{ap_id: "https://#{instance2}/@actor"})
@@ -969,7 +976,6 @@ test "by instance", %{conn: conn} do
response =
conn
- |> assign(:user, admin)
|> get("/api/pleroma/admin/stats", instance: instance2)
|> json_response(200)
diff --git a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs
index 5aefa1e60..dead1c09e 100644
--- a/test/pleroma/web/admin_api/controllers/chat_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/chat_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.ChatControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/web/admin_api/controllers/config_controller_test.exs b/test/pleroma/web/admin_api/controllers/config_controller_test.exs
index 4e897455f..df5d74d45 100644
--- a/test/pleroma/web/admin_api/controllers/config_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/config_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.ConfigControllerTest do
- use Pleroma.Web.ConnCase, async: true
+ use Pleroma.Web.ConnCase
import ExUnit.CaptureLog
import Pleroma.Factory
@@ -162,7 +162,9 @@ test "with valid `admin_token` query parameter, skips OAuth scopes check" do
end
end
- test "POST /api/pleroma/admin/config error", %{conn: conn} do
+ test "POST /api/pleroma/admin/config with configdb disabled", %{conn: conn} do
+ clear_config(:configurable_from_database, false)
+
conn =
conn
|> put_req_header("content-type", "application/json")
@@ -1415,11 +1417,7 @@ test "enables the welcome messages", %{conn: conn} do
describe "GET /api/pleroma/admin/config/descriptions" do
test "structure", %{conn: conn} do
- admin = insert(:user, is_admin: true)
-
- conn =
- assign(conn, :user, admin)
- |> get("/api/pleroma/admin/config/descriptions")
+ conn = get(conn, "/api/pleroma/admin/config/descriptions")
assert [child | _others] = json_response_and_validate_schema(conn, 200)
@@ -1437,11 +1435,7 @@ test "filters by database configuration whitelist", %{conn: conn} do
{:esshd}
])
- admin = insert(:user, is_admin: true)
-
- conn =
- assign(conn, :user, admin)
- |> get("/api/pleroma/admin/config/descriptions")
+ conn = get(conn, "/api/pleroma/admin/config/descriptions")
children = json_response_and_validate_schema(conn, 200)
diff --git a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs
new file mode 100644
index 000000000..94873f6db
--- /dev/null
+++ b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs
@@ -0,0 +1,141 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do
+ use Pleroma.Web.ConnCase
+
+ import Pleroma.Factory
+
+ alias Pleroma.Config
+
+ @dir "test/frontend_static_test"
+
+ setup do
+ clear_config([:instance, :static_dir], @dir)
+ File.mkdir_p!(Pleroma.Frontend.dir())
+
+ on_exit(fn ->
+ File.rm_rf(@dir)
+ end)
+
+ admin = insert(:user, is_admin: true)
+ token = insert(:oauth_admin_token, user: admin)
+
+ conn =
+ build_conn()
+ |> assign(:user, admin)
+ |> assign(:token, token)
+
+ {:ok, %{admin: admin, token: token, conn: conn}}
+ end
+
+ describe "GET /api/pleroma/admin/frontends" do
+ test "it lists available frontends", %{conn: conn} do
+ response =
+ conn
+ |> get("/api/pleroma/admin/frontends")
+ |> json_response_and_validate_schema(:ok)
+
+ assert Enum.map(response, & &1["name"]) ==
+ Enum.map(Config.get([:frontends, :available]), fn {_, map} -> map["name"] end)
+
+ refute Enum.any?(response, fn frontend -> frontend["installed"] == true end)
+ end
+ end
+
+ describe "POST /api/pleroma/admin/frontends/install" do
+ test "from available frontends", %{conn: conn} do
+ clear_config([:frontends, :available], %{
+ "pleroma" => %{
+ "ref" => "fantasy",
+ "name" => "pleroma",
+ "build_url" => "http://gensokyo.2hu/builds/${ref}"
+ }
+ })
+
+ Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/builds/fantasy"} ->
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend_dist.zip")}
+ end)
+
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/pleroma/admin/frontends/install", %{name: "pleroma"})
+ |> json_response_and_validate_schema(:ok)
+
+ assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
+
+ response =
+ conn
+ |> get("/api/pleroma/admin/frontends")
+ |> json_response_and_validate_schema(:ok)
+
+ assert response == [
+ %{
+ "build_url" => "http://gensokyo.2hu/builds/${ref}",
+ "git" => nil,
+ "installed" => true,
+ "name" => "pleroma",
+ "ref" => "fantasy"
+ }
+ ]
+ end
+
+ test "from a file", %{conn: conn} do
+ clear_config([:frontends, :available], %{
+ "pleroma" => %{
+ "ref" => "fantasy",
+ "name" => "pleroma",
+ "build_dir" => ""
+ }
+ })
+
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/pleroma/admin/frontends/install", %{
+ name: "pleroma",
+ file: "test/fixtures/tesla_mock/frontend.zip"
+ })
+ |> json_response_and_validate_schema(:ok)
+
+ assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
+ end
+
+ test "from an URL", %{conn: conn} do
+ Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/madeup.zip"} ->
+ %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
+ end)
+
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/pleroma/admin/frontends/install", %{
+ name: "unknown",
+ ref: "baka",
+ build_url: "http://gensokyo.2hu/madeup.zip",
+ build_dir: ""
+ })
+ |> json_response_and_validate_schema(:ok)
+
+ assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"]))
+ end
+
+ test "failing returns an error", %{conn: conn} do
+ Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/madeup.zip"} ->
+ %Tesla.Env{status: 404, body: ""}
+ end)
+
+ result =
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/pleroma/admin/frontends/install", %{
+ name: "unknown",
+ ref: "baka",
+ build_url: "http://gensokyo.2hu/madeup.zip",
+ build_dir: ""
+ })
+ |> json_response_and_validate_schema(400)
+
+ assert result == %{"error" => "Could not download or unzip the frontend"}
+ end
+ end
+end
diff --git a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs
index f243d1fb2..62fb9592a 100644
--- a/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/media_proxy_cache_controller_test.exs
@@ -12,10 +12,6 @@ defmodule Pleroma.Web.AdminAPI.MediaProxyCacheControllerTest do
setup do: clear_config([:media_proxy])
- setup do
- on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
- end
-
setup do
admin = insert(:user, is_admin: true)
token = insert(:oauth_admin_token, user: admin)
diff --git a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs
index b4c5e7567..379067a62 100644
--- a/test/pleroma/web/admin_api/controllers/relay_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/relay_controller_test.exs
@@ -60,7 +60,7 @@ test "GET /relay", %{conn: conn} do
conn = get(conn, "/api/pleroma/admin/relay")
- assert json_response_and_validate_schema(conn, 200)["relays"] == [
+ assert json_response_and_validate_schema(conn, 200)["relays"] |> Enum.sort() == [
%{
"actor" => "http://mastodon.example.org/users/admin",
"followed_back" => true
diff --git a/test/pleroma/web/admin_api/controllers/report_controller_test.exs b/test/pleroma/web/admin_api/controllers/report_controller_test.exs
index 958e1d3ab..2ab2f2f6d 100644
--- a/test/pleroma/web/admin_api/controllers/report_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/report_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.ReportControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
@@ -122,13 +122,13 @@ test "mark report as resolved", %{conn: conn, id: id, admin: admin} do
})
|> json_response_and_validate_schema(:no_content)
- activity = Activity.get_by_id(id)
+ activity = Activity.get_by_id_with_user_actor(id)
assert activity.data["state"] == "resolved"
log_entry = Repo.one(ModerationLog)
assert ModerationLog.get_log_entry_message(log_entry) ==
- "@#{admin.nickname} updated report ##{id} with 'resolved' state"
+ "@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state"
end
test "closes report", %{conn: conn, id: id, admin: admin} do
@@ -141,13 +141,13 @@ test "closes report", %{conn: conn, id: id, admin: admin} do
})
|> json_response_and_validate_schema(:no_content)
- activity = Activity.get_by_id(id)
+ activity = Activity.get_by_id_with_user_actor(id)
assert activity.data["state"] == "closed"
log_entry = Repo.one(ModerationLog)
assert ModerationLog.get_log_entry_message(log_entry) ==
- "@#{admin.nickname} updated report ##{id} with 'closed' state"
+ "@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'closed' state"
end
test "returns 400 when state is unknown", %{conn: conn, id: id} do
@@ -193,18 +193,20 @@ test "updates state of multiple reports", %{
})
|> json_response_and_validate_schema(:no_content)
- activity = Activity.get_by_id(id)
- second_activity = Activity.get_by_id(second_report_id)
+ activity = Activity.get_by_id_with_user_actor(id)
+ second_activity = Activity.get_by_id_with_user_actor(second_report_id)
assert activity.data["state"] == "resolved"
assert second_activity.data["state"] == "closed"
[first_log_entry, second_log_entry] = Repo.all(ModerationLog)
assert ModerationLog.get_log_entry_message(first_log_entry) ==
- "@#{admin.nickname} updated report ##{id} with 'resolved' state"
+ "@#{admin.nickname} updated report ##{id} (on user @#{activity.user_actor.nickname}) with 'resolved' state"
assert ModerationLog.get_log_entry_message(second_log_entry) ==
- "@#{admin.nickname} updated report ##{second_report_id} with 'closed' state"
+ "@#{admin.nickname} updated report ##{second_report_id} (on user @#{
+ second_activity.user_actor.nickname
+ }) with 'closed' state"
end
end
diff --git a/test/pleroma/web/admin_api/controllers/status_controller_test.exs b/test/pleroma/web/admin_api/controllers/status_controller_test.exs
index a18ef9e4b..40714c8a4 100644
--- a/test/pleroma/web/admin_api/controllers/status_controller_test.exs
+++ b/test/pleroma/web/admin_api/controllers/status_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.StatusControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/web/admin_api/search_test.exs b/test/pleroma/web/admin_api/search_test.exs
index 92a116c65..fdf22a8e6 100644
--- a/test/pleroma/web/admin_api/search_test.exs
+++ b/test/pleroma/web/admin_api/search_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.SearchTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.AdminAPI.Search
@@ -203,6 +203,7 @@ test "it returns unconfirmed user" do
assert count == 1
end
+ # Note: as in Mastodon, `is_discoverable` doesn't anyhow relate to user searchability
test "it returns non-discoverable users" do
insert(:user)
insert(:user, is_discoverable: false)
diff --git a/test/pleroma/web/admin_api/views/moderation_log_view_test.exs b/test/pleroma/web/admin_api/views/moderation_log_view_test.exs
new file mode 100644
index 000000000..a4748990e
--- /dev/null
+++ b/test/pleroma/web/admin_api/views/moderation_log_view_test.exs
@@ -0,0 +1,103 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+defmodule Pleroma.Web.AdminAPI.ModerationLogViewTest do
+ use Pleroma.DataCase, async: true
+
+ alias Pleroma.Web.AdminAPI.ModerationLogView
+
+ describe "renders `report_note_delete` log messages" do
+ setup do
+ log1 = %Pleroma.ModerationLog{
+ id: 1,
+ data: %{
+ "action" => "report_note_delete",
+ "actor" => %{"id" => "A1I7G8", "nickname" => "admin", "type" => "user"},
+ "message" => "@admin deleted note 'mistake' from report #A1I7be on user @b-612",
+ "subject" => %{"id" => "A1I7be", "state" => "open", "type" => "report"},
+ "subject_actor" => %{"id" => "A1I7G8", "nickname" => "b-612", "type" => "user"},
+ "text" => "mistake"
+ },
+ inserted_at: ~N[2020-11-17 14:13:20]
+ }
+
+ log2 = %Pleroma.ModerationLog{
+ id: 2,
+ data: %{
+ "action" => "report_note_delete",
+ "actor" => %{"id" => "A1I7G8", "nickname" => "admin", "type" => "user"},
+ "message" => "@admin deleted note 'fake user' from report #A1I7be on user @j-612",
+ "subject" => %{"id" => "A1I7be", "state" => "open", "type" => "report"},
+ "subject_actor" => %{"id" => "A1I7G8", "nickname" => "j-612", "type" => "user"},
+ "text" => "fake user"
+ },
+ inserted_at: ~N[2020-11-17 14:13:20]
+ }
+
+ {:ok, %{log1: log1, log2: log2}}
+ end
+
+ test "renders `report_note_delete` log messages", %{log1: log1, log2: log2} do
+ assert ModerationLogView.render(
+ "index.json",
+ %{log: %{items: [log1, log2], count: 2}}
+ ) == %{
+ items: [
+ %{
+ id: 1,
+ data: %{
+ "action" => "report_note_delete",
+ "actor" => %{"id" => "A1I7G8", "nickname" => "admin", "type" => "user"},
+ "message" =>
+ "@admin deleted note 'mistake' from report #A1I7be on user @b-612",
+ "subject" => %{"id" => "A1I7be", "state" => "open", "type" => "report"},
+ "subject_actor" => %{
+ "id" => "A1I7G8",
+ "nickname" => "b-612",
+ "type" => "user"
+ },
+ "text" => "mistake"
+ },
+ message: "@admin deleted note 'mistake' from report #A1I7be on user @b-612",
+ time: 1_605_622_400
+ },
+ %{
+ id: 2,
+ data: %{
+ "action" => "report_note_delete",
+ "actor" => %{"id" => "A1I7G8", "nickname" => "admin", "type" => "user"},
+ "message" =>
+ "@admin deleted note 'fake user' from report #A1I7be on user @j-612",
+ "subject" => %{"id" => "A1I7be", "state" => "open", "type" => "report"},
+ "subject_actor" => %{
+ "id" => "A1I7G8",
+ "nickname" => "j-612",
+ "type" => "user"
+ },
+ "text" => "fake user"
+ },
+ message: "@admin deleted note 'fake user' from report #A1I7be on user @j-612",
+ time: 1_605_622_400
+ }
+ ],
+ total: 2
+ }
+ end
+
+ test "renders `report_note_delete` log message", %{log1: log} do
+ assert ModerationLogView.render("show.json", %{log_entry: log}) == %{
+ id: 1,
+ data: %{
+ "action" => "report_note_delete",
+ "actor" => %{"id" => "A1I7G8", "nickname" => "admin", "type" => "user"},
+ "message" => "@admin deleted note 'mistake' from report #A1I7be on user @b-612",
+ "subject" => %{"id" => "A1I7be", "state" => "open", "type" => "report"},
+ "subject_actor" => %{"id" => "A1I7G8", "nickname" => "b-612", "type" => "user"},
+ "text" => "mistake"
+ },
+ message: "@admin deleted note 'mistake' from report #A1I7be on user @b-612",
+ time: 1_605_622_400
+ }
+ end
+ end
+end
diff --git a/test/pleroma/web/admin_api/views/report_view_test.exs b/test/pleroma/web/admin_api/views/report_view_test.exs
index 5a02292be..3914751b5 100644
--- a/test/pleroma/web/admin_api/views/report_view_test.exs
+++ b/test/pleroma/web/admin_api/views/report_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.AdminAPI.ReportViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
@@ -143,4 +143,29 @@ test "doesn't error out when the user doesn't exists" do
assert %{} = ReportView.render("show.json", Report.extract_report_info(activity))
end
+
+ test "reports are ordered newest first" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, report1} =
+ CommonAPI.report(user, %{
+ account_id: other_user.id,
+ comment: "first report"
+ })
+
+ {:ok, report2} =
+ CommonAPI.report(user, %{
+ account_id: other_user.id,
+ comment: "second report"
+ })
+
+ %{reports: rendered} =
+ ReportView.render("index.json",
+ reports: Pleroma.Web.ActivityPub.Utils.get_reports(%{}, 1, 50)
+ )
+
+ assert report2.id == rendered |> Enum.at(0) |> Map.get(:id)
+ assert report1.id == rendered |> Enum.at(1) |> Map.get(:id)
+ end
end
diff --git a/test/pleroma/web/auth/authenticator_test.exs b/test/pleroma/web/auth/authenticator_test.exs
index d54253343..862eb8051 100644
--- a/test/pleroma/web/auth/authenticator_test.exs
+++ b/test/pleroma/web/auth/authenticator_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Auth.AuthenticatorTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.Auth.Authenticator
import Pleroma.Factory
diff --git a/test/pleroma/web/auth/basic_auth_test.exs b/test/pleroma/web/auth/basic_auth_test.exs
index bf6e3d2fc..e56c1e1e8 100644
--- a/test/pleroma/web/auth/basic_auth_test.exs
+++ b/test/pleroma/web/auth/basic_auth_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Auth.BasicAuthTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/web/auth/pleroma_authenticator_test.exs b/test/pleroma/web/auth/pleroma_authenticator_test.exs
index 1ba0dfecc..4539ffe87 100644
--- a/test/pleroma/web/auth/pleroma_authenticator_test.exs
+++ b/test/pleroma/web/auth/pleroma_authenticator_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Auth.PleromaAuthenticatorTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.Auth.PleromaAuthenticator
import Pleroma.Factory
diff --git a/test/pleroma/web/auth/totp_authenticator_test.exs b/test/pleroma/web/auth/totp_authenticator_test.exs
index 84d4cd840..7f99d62bf 100644
--- a/test/pleroma/web/auth/totp_authenticator_test.exs
+++ b/test/pleroma/web/auth/totp_authenticator_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Auth.TOTPAuthenticatorTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.MFA
alias Pleroma.MFA.BackupCodes
diff --git a/test/pleroma/web/common_api/utils_test.exs b/test/pleroma/web/common_api/utils_test.exs
index e67c10b93..4d6c9ea26 100644
--- a/test/pleroma/web/common_api/utils_test.exs
+++ b/test/pleroma/web/common_api/utils_test.exs
@@ -6,6 +6,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
alias Pleroma.Builders.UserBuilder
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.CommonAPI.ActivityDraft
alias Pleroma.Web.CommonAPI.Utils
use Pleroma.DataCase
@@ -235,9 +236,9 @@ test "when date is a random string" do
test "for public posts, not a reply" do
user = insert(:user)
mentioned_user = insert(:user)
- mentions = [mentioned_user.ap_id]
+ draft = %ActivityDraft{user: user, mentions: [mentioned_user.ap_id], visibility: "public"}
- {to, cc} = Utils.get_to_and_cc(user, mentions, nil, "public", nil)
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 2
assert length(cc) == 1
@@ -252,9 +253,15 @@ test "for public posts, a reply" do
mentioned_user = insert(:user)
third_user = insert(:user)
{:ok, activity} = CommonAPI.post(third_user, %{status: "uguu"})
- mentions = [mentioned_user.ap_id]
- {to, cc} = Utils.get_to_and_cc(user, mentions, activity, "public", nil)
+ draft = %ActivityDraft{
+ user: user,
+ mentions: [mentioned_user.ap_id],
+ visibility: "public",
+ in_reply_to: activity
+ }
+
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 3
assert length(cc) == 1
@@ -268,9 +275,9 @@ test "for public posts, a reply" do
test "for unlisted posts, not a reply" do
user = insert(:user)
mentioned_user = insert(:user)
- mentions = [mentioned_user.ap_id]
+ draft = %ActivityDraft{user: user, mentions: [mentioned_user.ap_id], visibility: "unlisted"}
- {to, cc} = Utils.get_to_and_cc(user, mentions, nil, "unlisted", nil)
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 2
assert length(cc) == 1
@@ -285,9 +292,15 @@ test "for unlisted posts, a reply" do
mentioned_user = insert(:user)
third_user = insert(:user)
{:ok, activity} = CommonAPI.post(third_user, %{status: "uguu"})
- mentions = [mentioned_user.ap_id]
- {to, cc} = Utils.get_to_and_cc(user, mentions, activity, "unlisted", nil)
+ draft = %ActivityDraft{
+ user: user,
+ mentions: [mentioned_user.ap_id],
+ visibility: "unlisted",
+ in_reply_to: activity
+ }
+
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 3
assert length(cc) == 1
@@ -301,9 +314,9 @@ test "for unlisted posts, a reply" do
test "for private posts, not a reply" do
user = insert(:user)
mentioned_user = insert(:user)
- mentions = [mentioned_user.ap_id]
+ draft = %ActivityDraft{user: user, mentions: [mentioned_user.ap_id], visibility: "private"}
- {to, cc} = Utils.get_to_and_cc(user, mentions, nil, "private", nil)
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 2
assert Enum.empty?(cc)
@@ -316,9 +329,15 @@ test "for private posts, a reply" do
mentioned_user = insert(:user)
third_user = insert(:user)
{:ok, activity} = CommonAPI.post(third_user, %{status: "uguu"})
- mentions = [mentioned_user.ap_id]
- {to, cc} = Utils.get_to_and_cc(user, mentions, activity, "private", nil)
+ draft = %ActivityDraft{
+ user: user,
+ mentions: [mentioned_user.ap_id],
+ visibility: "private",
+ in_reply_to: activity
+ }
+
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 2
assert Enum.empty?(cc)
@@ -330,9 +349,9 @@ test "for private posts, a reply" do
test "for direct posts, not a reply" do
user = insert(:user)
mentioned_user = insert(:user)
- mentions = [mentioned_user.ap_id]
+ draft = %ActivityDraft{user: user, mentions: [mentioned_user.ap_id], visibility: "direct"}
- {to, cc} = Utils.get_to_and_cc(user, mentions, nil, "direct", nil)
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 1
assert Enum.empty?(cc)
@@ -345,9 +364,15 @@ test "for direct posts, a reply" do
mentioned_user = insert(:user)
third_user = insert(:user)
{:ok, activity} = CommonAPI.post(third_user, %{status: "uguu"})
- mentions = [mentioned_user.ap_id]
- {to, cc} = Utils.get_to_and_cc(user, mentions, activity, "direct", nil)
+ draft = %ActivityDraft{
+ user: user,
+ mentions: [mentioned_user.ap_id],
+ visibility: "direct",
+ in_reply_to: activity
+ }
+
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 1
assert Enum.empty?(cc)
@@ -356,7 +381,14 @@ test "for direct posts, a reply" do
{:ok, direct_activity} = CommonAPI.post(third_user, %{status: "uguu", visibility: "direct"})
- {to, cc} = Utils.get_to_and_cc(user, mentions, direct_activity, "direct", nil)
+ draft = %ActivityDraft{
+ user: user,
+ mentions: [mentioned_user.ap_id],
+ visibility: "direct",
+ in_reply_to: direct_activity
+ }
+
+ {to, cc} = Utils.get_to_and_cc(draft)
assert length(to) == 2
assert Enum.empty?(cc)
@@ -532,26 +564,26 @@ test "returns original params when list not found" do
end
end
- describe "make_note_data/11" do
+ describe "make_note_data/1" do
test "returns note data" do
user = insert(:user)
note = insert(:note)
user2 = insert(:user)
user3 = insert(:user)
- assert Utils.make_note_data(
- user.ap_id,
- [user2.ap_id],
- "2hu",
- "This is :moominmamma: note ",
- [],
- note.id,
- [name: "jimm"],
- "test summary",
- [user3.ap_id],
- false,
- %{"custom_tag" => "test"}
- ) == %{
+ draft = %ActivityDraft{
+ user: user,
+ to: [user2.ap_id],
+ context: "2hu",
+ content_html: "This is :moominmamma: note ",
+ in_reply_to: note.id,
+ tags: [name: "jimm"],
+ summary: "test summary",
+ cc: [user3.ap_id],
+ extra: %{"custom_tag" => "test"}
+ }
+
+ assert Utils.make_note_data(draft) == %{
"actor" => user.ap_id,
"attachment" => [],
"cc" => [user3.ap_id],
diff --git a/test/pleroma/web/common_api_test.exs b/test/pleroma/web/common_api_test.exs
index c5b90ad84..585b2c174 100644
--- a/test/pleroma/web/common_api_test.exs
+++ b/test/pleroma/web/common_api_test.exs
@@ -3,8 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.CommonAPITest do
- use Pleroma.DataCase
use Oban.Testing, repo: Pleroma.Repo
+ use Pleroma.DataCase
alias Pleroma.Activity
alias Pleroma.Chat
@@ -922,12 +922,34 @@ test "add mute", %{user: user, activity: activity} do
assert CommonAPI.thread_muted?(user, activity)
end
+ test "add expiring mute", %{user: user, activity: activity} do
+ {:ok, _} = CommonAPI.add_mute(user, activity, %{expires_in: 60})
+ assert CommonAPI.thread_muted?(user, activity)
+
+ worker = Pleroma.Workers.MuteExpireWorker
+ args = %{"op" => "unmute_conversation", "user_id" => user.id, "activity_id" => activity.id}
+
+ assert_enqueued(
+ worker: worker,
+ args: args
+ )
+
+ assert :ok = perform_job(worker, args)
+ refute CommonAPI.thread_muted?(user, activity)
+ end
+
test "remove mute", %{user: user, activity: activity} do
CommonAPI.add_mute(user, activity)
{:ok, _} = CommonAPI.remove_mute(user, activity)
refute CommonAPI.thread_muted?(user, activity)
end
+ test "remove mute by ids", %{user: user, activity: activity} do
+ CommonAPI.add_mute(user, activity)
+ {:ok, _} = CommonAPI.remove_mute(user.id, activity.id)
+ refute CommonAPI.thread_muted?(user, activity)
+ end
+
test "check that mutes can't be duplicate", %{user: user, activity: activity} do
CommonAPI.add_mute(user, activity)
{:error, _} = CommonAPI.add_mute(user, activity)
@@ -1255,4 +1277,128 @@ test "fallback" do
} = CommonAPI.get_user("")
end
end
+
+ describe "with `local` visibility" do
+ setup do: clear_config([:instance, :federating], true)
+
+ test "post" do
+ user = insert(:user)
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ {:ok, activity} = CommonAPI.post(user, %{status: "#2hu #2HU", visibility: "local"})
+
+ assert Visibility.is_local_public?(activity)
+ assert_not_called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "delete" do
+ user = insert(:user)
+
+ {:ok, %Activity{id: activity_id}} =
+ CommonAPI.post(user, %{status: "#2hu #2HU", visibility: "local"})
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"deleted_activity_id" => ^activity_id}} = activity} =
+ CommonAPI.delete(activity_id, user)
+
+ assert Visibility.is_local_public?(activity)
+ assert_not_called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "repeat" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, %Activity{id: activity_id}} =
+ CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"type" => "Announce"}} = activity} =
+ CommonAPI.repeat(activity_id, user)
+
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "unrepeat" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, %Activity{id: activity_id}} =
+ CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ assert {:ok, _} = CommonAPI.repeat(activity_id, user)
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"type" => "Undo"}} = activity} =
+ CommonAPI.unrepeat(activity_id, user)
+
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "favorite" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"type" => "Like"}} = activity} =
+ CommonAPI.favorite(user, activity.id)
+
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "unfavorite" do
+ user = insert(:user)
+ other_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ {:ok, %Activity{}} = CommonAPI.favorite(user, activity.id)
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, activity} = CommonAPI.unfavorite(activity.id, user)
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "react_with_emoji" do
+ user = insert(:user)
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"type" => "EmojiReact"}} = activity} =
+ CommonAPI.react_with_emoji(activity.id, user, "👍")
+
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+
+ test "unreact_with_emoji" do
+ user = insert(:user)
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(other_user, %{status: "cofe", visibility: "local"})
+
+ {:ok, _reaction} = CommonAPI.react_with_emoji(activity.id, user, "👍")
+
+ with_mock Pleroma.Web.Federator, publish: fn _ -> :ok end do
+ assert {:ok, %Activity{data: %{"type" => "Undo"}} = activity} =
+ CommonAPI.unreact_with_emoji(activity.id, user, "👍")
+
+ assert Visibility.is_local_public?(activity)
+ refute called(Pleroma.Web.Federator.publish(activity))
+ end
+ end
+ end
end
diff --git a/test/pleroma/web/endpoint/metrics_exporter_test.exs b/test/pleroma/web/endpoint/metrics_exporter_test.exs
index 875addc96..d0cae3d42 100644
--- a/test/pleroma/web/endpoint/metrics_exporter_test.exs
+++ b/test/pleroma/web/endpoint/metrics_exporter_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Endpoint.MetricsExporterTest do
+ # Modifies AppEnv, has to stay synchronous
use Pleroma.Web.ConnCase
alias Pleroma.Web.Endpoint.MetricsExporter
diff --git a/test/pleroma/web/fallback_test.exs b/test/pleroma/web/fallback_test.exs
index a65865860..46c7bad1c 100644
--- a/test/pleroma/web/fallback_test.exs
+++ b/test/pleroma/web/fallback_test.exs
@@ -20,15 +20,26 @@ test "GET /*path", %{conn: conn} do
end
end
+ test "GET /*path adds a title", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
+ assert conn
+ |> get("/")
+ |> html_response(200) =~ "a cool title "
+ end
+
describe "preloaded data and metadata attached to" do
test "GET /:maybe_nickname_or_id", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
user = insert(:user)
user_missing = get(conn, "/foo")
user_present = get(conn, "/#{user.nickname}")
- assert(html_response(user_missing, 200) =~ "")
+ assert html_response(user_missing, 200) =~ ""
refute html_response(user_present, 200) =~ ""
assert html_response(user_present, 200) =~ "initial-results"
+ assert html_response(user_present, 200) =~ "a cool title "
end
test "GET /*path", %{conn: conn} do
@@ -44,10 +55,13 @@ test "GET /*path", %{conn: conn} do
describe "preloaded data is attached to" do
test "GET /main/public", %{conn: conn} do
+ clear_config([:instance, :name], "a cool title")
+
public_page = get(conn, "/main/public")
refute html_response(public_page, 200) =~ ""
assert html_response(public_page, 200) =~ "initial-results"
+ assert html_response(public_page, 200) =~ "a cool title "
end
test "GET /main/all", %{conn: conn} do
diff --git a/test/pleroma/web/fed_sockets/fed_registry_test.exs b/test/pleroma/web/fed_sockets/fed_registry_test.exs
deleted file mode 100644
index 73aaced46..000000000
--- a/test/pleroma/web/fed_sockets/fed_registry_test.exs
+++ /dev/null
@@ -1,124 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.FedSockets.FedRegistryTest do
- use ExUnit.Case
-
- alias Pleroma.Web.FedSockets
- alias Pleroma.Web.FedSockets.FedRegistry
- alias Pleroma.Web.FedSockets.SocketInfo
-
- @good_domain "http://good.domain"
- @good_domain_origin "good.domain:80"
-
- setup do
- start_supervised({Pleroma.Web.FedSockets.Supervisor, []})
- build_test_socket(@good_domain)
- Process.sleep(10)
-
- :ok
- end
-
- describe "add_fed_socket/1 without conflicting sockets" do
- test "can be added" do
- Process.sleep(10)
- assert {:ok, %SocketInfo{origin: origin}} = FedRegistry.get_fed_socket(@good_domain_origin)
- assert origin == "good.domain:80"
- end
-
- test "multiple origins can be added" do
- build_test_socket("http://anothergood.domain")
- Process.sleep(10)
-
- assert {:ok, %SocketInfo{origin: origin_1}} =
- FedRegistry.get_fed_socket(@good_domain_origin)
-
- assert {:ok, %SocketInfo{origin: origin_2}} =
- FedRegistry.get_fed_socket("anothergood.domain:80")
-
- assert origin_1 == "good.domain:80"
- assert origin_2 == "anothergood.domain:80"
- assert FedRegistry.list_all() |> Enum.count() == 2
- end
- end
-
- describe "add_fed_socket/1 when duplicate sockets conflict" do
- setup do
- build_test_socket(@good_domain)
- build_test_socket(@good_domain)
- Process.sleep(10)
- :ok
- end
-
- test "will be ignored" do
- assert {:ok, %SocketInfo{origin: origin, pid: _pid_one}} =
- FedRegistry.get_fed_socket(@good_domain_origin)
-
- assert origin == "good.domain:80"
-
- assert FedRegistry.list_all() |> Enum.count() == 1
- end
-
- test "the newer process will be closed" do
- pid_two = build_test_socket(@good_domain)
-
- assert {:ok, %SocketInfo{origin: origin, pid: _pid_one}} =
- FedRegistry.get_fed_socket(@good_domain_origin)
-
- assert origin == "good.domain:80"
- Process.sleep(10)
-
- refute Process.alive?(pid_two)
-
- assert FedRegistry.list_all() |> Enum.count() == 1
- end
- end
-
- describe "get_fed_socket/1" do
- test "returns missing for unknown hosts" do
- assert {:error, :missing} = FedRegistry.get_fed_socket("not_a_dmoain")
- end
-
- test "returns rejected for hosts previously rejected" do
- "rejected.domain:80"
- |> FedSockets.uri_for_origin()
- |> FedRegistry.set_host_rejected()
-
- assert {:error, :rejected} = FedRegistry.get_fed_socket("rejected.domain:80")
- end
-
- test "can retrieve a previously added SocketInfo" do
- build_test_socket(@good_domain)
- Process.sleep(10)
- assert {:ok, %SocketInfo{origin: origin}} = FedRegistry.get_fed_socket(@good_domain_origin)
- assert origin == "good.domain:80"
- end
-
- test "removes references to SocketInfos when the process crashes" do
- assert {:ok, %SocketInfo{origin: origin, pid: pid}} =
- FedRegistry.get_fed_socket(@good_domain_origin)
-
- assert origin == "good.domain:80"
-
- Process.exit(pid, :testing)
- Process.sleep(100)
- assert {:error, :missing} = FedRegistry.get_fed_socket(@good_domain_origin)
- end
- end
-
- def build_test_socket(uri) do
- Kernel.spawn(fn -> fed_socket_almost(uri) end)
- end
-
- def fed_socket_almost(origin) do
- FedRegistry.add_fed_socket(origin)
-
- receive do
- :close ->
- :ok
- after
- 5_000 -> :timeout
- end
- end
-end
diff --git a/test/pleroma/web/fed_sockets/fetch_registry_test.exs b/test/pleroma/web/fed_sockets/fetch_registry_test.exs
deleted file mode 100644
index 7bd2d995a..000000000
--- a/test/pleroma/web/fed_sockets/fetch_registry_test.exs
+++ /dev/null
@@ -1,67 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.FedSockets.FetchRegistryTest do
- use ExUnit.Case
-
- alias Pleroma.Web.FedSockets.FetchRegistry
- alias Pleroma.Web.FedSockets.FetchRegistry.FetchRegistryData
-
- @json_message "hello"
- @json_reply "hello back"
-
- setup do
- start_supervised(
- {Pleroma.Web.FedSockets.Supervisor,
- [
- ping_interval: 8,
- connection_duration: 15,
- rejection_duration: 5,
- fed_socket_fetches: [default: 10, interval: 10]
- ]}
- )
-
- :ok
- end
-
- test "fetches can be stored" do
- uuid = FetchRegistry.register_fetch(@json_message)
-
- assert {:error, :waiting} = FetchRegistry.check_fetch(uuid)
- end
-
- test "fetches can return" do
- uuid = FetchRegistry.register_fetch(@json_message)
- task = Task.async(fn -> FetchRegistry.register_fetch_received(uuid, @json_reply) end)
-
- assert {:error, :waiting} = FetchRegistry.check_fetch(uuid)
- Task.await(task)
-
- assert {:ok, %FetchRegistryData{received_json: received_json}} =
- FetchRegistry.check_fetch(uuid)
-
- assert received_json == @json_reply
- end
-
- test "fetches are deleted once popped from stack" do
- uuid = FetchRegistry.register_fetch(@json_message)
- task = Task.async(fn -> FetchRegistry.register_fetch_received(uuid, @json_reply) end)
- Task.await(task)
-
- assert {:ok, %FetchRegistryData{received_json: received_json}} =
- FetchRegistry.check_fetch(uuid)
-
- assert received_json == @json_reply
- assert {:ok, @json_reply} = FetchRegistry.pop_fetch(uuid)
-
- assert {:error, :missing} = FetchRegistry.check_fetch(uuid)
- end
-
- test "fetches can time out" do
- uuid = FetchRegistry.register_fetch(@json_message)
- assert {:error, :waiting} = FetchRegistry.check_fetch(uuid)
- Process.sleep(500)
- assert {:error, :missing} = FetchRegistry.check_fetch(uuid)
- end
-end
diff --git a/test/pleroma/web/fed_sockets/socket_info_test.exs b/test/pleroma/web/fed_sockets/socket_info_test.exs
deleted file mode 100644
index db3d6edcd..000000000
--- a/test/pleroma/web/fed_sockets/socket_info_test.exs
+++ /dev/null
@@ -1,118 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.FedSockets.SocketInfoTest do
- use ExUnit.Case
-
- alias Pleroma.Web.FedSockets
- alias Pleroma.Web.FedSockets.SocketInfo
-
- describe "uri_for_origin" do
- test "provides the fed_socket URL given the origin information" do
- endpoint = "example.com:4000"
- assert FedSockets.uri_for_origin(endpoint) =~ "ws://"
- assert FedSockets.uri_for_origin(endpoint) =~ endpoint
- end
- end
-
- describe "origin" do
- test "will provide the origin field given a url" do
- endpoint = "example.com:4000"
- assert SocketInfo.origin("ws://#{endpoint}") == endpoint
- assert SocketInfo.origin("http://#{endpoint}") == endpoint
- assert SocketInfo.origin("https://#{endpoint}") == endpoint
- end
-
- test "will proide the origin field given a uri" do
- endpoint = "example.com:4000"
- uri = URI.parse("http://#{endpoint}")
-
- assert SocketInfo.origin(uri) == endpoint
- end
- end
-
- describe "touch" do
- test "will update the TTL" do
- endpoint = "example.com:4000"
- socket = SocketInfo.build("ws://#{endpoint}")
- Process.sleep(2)
- touched_socket = SocketInfo.touch(socket)
-
- assert socket.connected_until < touched_socket.connected_until
- end
- end
-
- describe "expired?" do
- setup do
- start_supervised(
- {Pleroma.Web.FedSockets.Supervisor,
- [
- ping_interval: 8,
- connection_duration: 5,
- rejection_duration: 5,
- fed_socket_rejections: [lazy: true]
- ]}
- )
-
- :ok
- end
-
- test "tests if the TTL is exceeded" do
- endpoint = "example.com:4000"
- socket = SocketInfo.build("ws://#{endpoint}")
- refute SocketInfo.expired?(socket)
- Process.sleep(10)
-
- assert SocketInfo.expired?(socket)
- end
- end
-
- describe "creating outgoing connection records" do
- test "can be passed a string" do
- assert %{conn_pid: :pid, origin: _origin} = SocketInfo.build("example.com:4000", :pid)
- end
-
- test "can be passed a URI" do
- uri = URI.parse("http://example.com:4000")
- assert %{conn_pid: :pid, origin: origin} = SocketInfo.build(uri, :pid)
- assert origin =~ "example.com:4000"
- end
-
- test "will include the port number" do
- assert %{conn_pid: :pid, origin: origin} = SocketInfo.build("http://example.com:4000", :pid)
-
- assert origin =~ ":4000"
- end
-
- test "will provide the port if missing" do
- assert %{conn_pid: :pid, origin: "example.com:80"} =
- SocketInfo.build("http://example.com", :pid)
-
- assert %{conn_pid: :pid, origin: "example.com:443"} =
- SocketInfo.build("https://example.com", :pid)
- end
- end
-
- describe "creating incoming connection records" do
- test "can be passed a string" do
- assert %{pid: _, origin: _origin} = SocketInfo.build("example.com:4000")
- end
-
- test "can be passed a URI" do
- uri = URI.parse("example.com:4000")
- assert %{pid: _, origin: _origin} = SocketInfo.build(uri)
- end
-
- test "will include the port number" do
- assert %{pid: _, origin: origin} = SocketInfo.build("http://example.com:4000")
-
- assert origin =~ ":4000"
- end
-
- test "will provide the port if missing" do
- assert %{pid: _, origin: "example.com:80"} = SocketInfo.build("http://example.com")
- assert %{pid: _, origin: "example.com:443"} = SocketInfo.build("https://example.com")
- end
- end
-end
diff --git a/test/pleroma/web/federator_test.exs b/test/pleroma/web/federator_test.exs
index 592fdccd1..67001add7 100644
--- a/test/pleroma/web/federator_test.exs
+++ b/test/pleroma/web/federator_test.exs
@@ -164,7 +164,7 @@ test "it does not crash if MRF rejects the post" do
params =
File.read!("test/fixtures/mastodon-post-activity.json")
- |> Poison.decode!()
+ |> Jason.decode!()
assert {:ok, job} = Federator.incoming_ap_doc(params)
assert {:error, _} = ObanHelpers.perform(job)
diff --git a/test/pleroma/web/feed/tag_controller_test.exs b/test/pleroma/web/feed/tag_controller_test.exs
index e4084b0e5..b4abcf6f2 100644
--- a/test/pleroma/web/feed/tag_controller_test.exs
+++ b/test/pleroma/web/feed/tag_controller_test.exs
@@ -131,7 +131,7 @@ test "gets a feed (RSS)", %{conn: conn} do
'#{Pleroma.Web.base_url()}/tags/pleromaart.rss'
assert xpath(xml, ~x"//channel/webfeeds:logo/text()") ==
- '#{Pleroma.Web.base_url()}/static/logo.png'
+ '#{Pleroma.Web.base_url()}/static/logo.svg'
assert xpath(xml, ~x"//channel/item/title/text()"l) == [
'42 This is :moominmamm...',
diff --git a/test/pleroma/web/feed/user_controller_test.exs b/test/pleroma/web/feed/user_controller_test.exs
index eabfe3a63..16f002717 100644
--- a/test/pleroma/web/feed/user_controller_test.exs
+++ b/test/pleroma/web/feed/user_controller_test.exs
@@ -12,16 +12,17 @@ defmodule Pleroma.Web.Feed.UserControllerTest do
alias Pleroma.Object
alias Pleroma.User
alias Pleroma.Web.CommonAPI
+ alias Pleroma.Web.Feed.FeedView
setup do: clear_config([:static_fe, :enabled], false)
describe "feed" do
setup do: clear_config([:feed])
- test "gets an atom feed", %{conn: conn} do
+ setup do
Config.put(
[:feed, :post_title],
- %{max_length: 10, omission: "..."}
+ %{max_length: 15, omission: "..."}
)
activity = insert(:note_activity)
@@ -29,7 +30,8 @@ test "gets an atom feed", %{conn: conn} do
note =
insert(:note,
data: %{
- "content" => "This is :moominmamma: note ",
+ "content" => "This & this is :moominmamma: note ",
+ "source" => "This & this is :moominmamma: note ",
"attachment" => [
%{
"url" => [
@@ -37,7 +39,9 @@ test "gets an atom feed", %{conn: conn} do
]
}
],
- "inReplyTo" => activity.data["id"]
+ "inReplyTo" => activity.data["id"],
+ "context" => "2hu & as",
+ "summary" => "2hu & as"
}
)
@@ -48,7 +52,7 @@ test "gets an atom feed", %{conn: conn} do
insert(:note,
user: user,
data: %{
- "content" => "42 This is :moominmamma: note ",
+ "content" => "42 & This is :moominmamma: note ",
"inReplyTo" => activity.data["id"]
}
)
@@ -56,6 +60,10 @@ test "gets an atom feed", %{conn: conn} do
note_activity2 = insert(:note_activity, note: note2)
object = Object.normalize(note_activity)
+ [user: user, object: object, max_id: note_activity2.id]
+ end
+
+ test "gets an atom feed", %{conn: conn, user: user, object: object, max_id: max_id} do
resp =
conn
|> put_req_header("accept", "application/atom+xml")
@@ -67,13 +75,15 @@ test "gets an atom feed", %{conn: conn} do
|> SweetXml.parse()
|> SweetXml.xpath(~x"//entry/title/text()"l)
- assert activity_titles == ['42 This...', 'This is...']
- assert resp =~ object.data["content"]
+ assert activity_titles == ['42 & Thi...', 'This & t...']
+ assert resp =~ FeedView.escape(object.data["content"])
+ assert resp =~ FeedView.escape(object.data["summary"])
+ assert resp =~ FeedView.escape(object.data["context"])
resp =
conn
|> put_req_header("accept", "application/atom+xml")
- |> get("/users/#{user.nickname}/feed", %{"max_id" => note_activity2.id})
+ |> get("/users/#{user.nickname}/feed", %{"max_id" => max_id})
|> response(200)
activity_titles =
@@ -81,47 +91,10 @@ test "gets an atom feed", %{conn: conn} do
|> SweetXml.parse()
|> SweetXml.xpath(~x"//entry/title/text()"l)
- assert activity_titles == ['This is...']
+ assert activity_titles == ['This & t...']
end
- test "gets a rss feed", %{conn: conn} do
- Pleroma.Config.put(
- [:feed, :post_title],
- %{max_length: 10, omission: "..."}
- )
-
- activity = insert(:note_activity)
-
- note =
- insert(:note,
- data: %{
- "content" => "This is :moominmamma: note ",
- "attachment" => [
- %{
- "url" => [
- %{"mediaType" => "image/png", "href" => "https://pleroma.gov/image.png"}
- ]
- }
- ],
- "inReplyTo" => activity.data["id"]
- }
- )
-
- note_activity = insert(:note_activity, note: note)
- user = User.get_cached_by_ap_id(note_activity.data["actor"])
-
- note2 =
- insert(:note,
- user: user,
- data: %{
- "content" => "42 This is :moominmamma: note ",
- "inReplyTo" => activity.data["id"]
- }
- )
-
- note_activity2 = insert(:note_activity, note: note2)
- object = Object.normalize(note_activity)
-
+ test "gets a rss feed", %{conn: conn, user: user, object: object, max_id: max_id} do
resp =
conn
|> put_req_header("accept", "application/rss+xml")
@@ -133,13 +106,15 @@ test "gets a rss feed", %{conn: conn} do
|> SweetXml.parse()
|> SweetXml.xpath(~x"//item/title/text()"l)
- assert activity_titles == ['42 This...', 'This is...']
- assert resp =~ object.data["content"]
+ assert activity_titles == ['42 & Thi...', 'This & t...']
+ assert resp =~ FeedView.escape(object.data["content"])
+ assert resp =~ FeedView.escape(object.data["summary"])
+ assert resp =~ FeedView.escape(object.data["context"])
resp =
conn
|> put_req_header("accept", "application/rss+xml")
- |> get("/users/#{user.nickname}/feed.rss", %{"max_id" => note_activity2.id})
+ |> get("/users/#{user.nickname}/feed.rss", %{"max_id" => max_id})
|> response(200)
activity_titles =
@@ -147,7 +122,7 @@ test "gets a rss feed", %{conn: conn} do
|> SweetXml.parse()
|> SweetXml.xpath(~x"//item/title/text()"l)
- assert activity_titles == ['This is...']
+ assert activity_titles == ['This & t...']
end
test "returns 404 for a missing feed", %{conn: conn} do
diff --git a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
index 58ce76ab8..cc7b3cf8b 100644
--- a/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/account_controller_test.exs
@@ -320,7 +320,7 @@ test "gets users statuses", %{conn: conn} do
user_two = insert(:user)
user_three = insert(:user)
- {:ok, _user_three} = User.follow(user_three, user_one)
+ {:ok, _user_three, _user_one} = User.follow(user_three, user_one)
{:ok, activity} = CommonAPI.post(user_one, %{status: "HI!!!"})
@@ -436,6 +436,54 @@ test "the user views their own timelines and excludes direct messages", %{
conn = get(conn, "/api/v1/accounts/#{user.id}/statuses?exclude_visibilities[]=direct")
assert [%{"id" => ^public_activity_id}] = json_response_and_validate_schema(conn, 200)
end
+
+ test "muted reactions", %{user: user, conn: conn} do
+ user2 = insert(:user)
+ User.mute(user, user2)
+ {:ok, activity} = CommonAPI.post(user, %{status: "."})
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user2, "🎅")
+
+ result =
+ conn
+ |> get("/api/v1/accounts/#{user.id}/statuses")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> get("/api/v1/accounts/#{user.id}/statuses?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
+
+ test "paginates a user's statuses", %{user: user, conn: conn} do
+ {:ok, post_1} = CommonAPI.post(user, %{status: "first post"})
+ {:ok, post_2} = CommonAPI.post(user, %{status: "second post"})
+
+ response_1 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1")
+ assert [res] = json_response(response_1, 200)
+ assert res["id"] == post_2.id
+
+ response_2 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1&max_id=#{res["id"]}")
+ assert [res] = json_response(response_2, 200)
+ assert res["id"] == post_1.id
+
+ refute response_1 == response_2
+ end
end
defp local_and_remote_activities(%{local: local, remote: remote}) do
@@ -535,7 +583,7 @@ test "if user is authenticated", %{local: local, remote: remote} do
test "getting followers", %{user: user, conn: conn} do
other_user = insert(:user)
- {:ok, %{id: user_id}} = User.follow(user, other_user)
+ {:ok, %{id: user_id}, other_user} = User.follow(user, other_user)
conn = get(conn, "/api/v1/accounts/#{other_user.id}/followers")
@@ -544,7 +592,7 @@ test "getting followers", %{user: user, conn: conn} do
test "getting followers, hide_followers", %{user: user, conn: conn} do
other_user = insert(:user, hide_followers: true)
- {:ok, _user} = User.follow(user, other_user)
+ {:ok, _user, _other_user} = User.follow(user, other_user)
conn = get(conn, "/api/v1/accounts/#{other_user.id}/followers")
@@ -554,7 +602,7 @@ test "getting followers, hide_followers", %{user: user, conn: conn} do
test "getting followers, hide_followers, same user requesting" do
user = insert(:user)
other_user = insert(:user, hide_followers: true)
- {:ok, _user} = User.follow(user, other_user)
+ {:ok, _user, _other_user} = User.follow(user, other_user)
conn =
build_conn()
@@ -566,9 +614,9 @@ test "getting followers, hide_followers, same user requesting" do
end
test "getting followers, pagination", %{user: user, conn: conn} do
- {:ok, %User{id: follower1_id}} = :user |> insert() |> User.follow(user)
- {:ok, %User{id: follower2_id}} = :user |> insert() |> User.follow(user)
- {:ok, %User{id: follower3_id}} = :user |> insert() |> User.follow(user)
+ {:ok, %User{id: follower1_id}, _user} = :user |> insert() |> User.follow(user)
+ {:ok, %User{id: follower2_id}, _user} = :user |> insert() |> User.follow(user)
+ {:ok, %User{id: follower3_id}, _user} = :user |> insert() |> User.follow(user)
assert [%{"id" => ^follower3_id}, %{"id" => ^follower2_id}] =
conn
@@ -604,7 +652,7 @@ test "getting followers, pagination", %{user: user, conn: conn} do
test "getting following", %{user: user, conn: conn} do
other_user = insert(:user)
- {:ok, user} = User.follow(user, other_user)
+ {:ok, user, other_user} = User.follow(user, other_user)
conn = get(conn, "/api/v1/accounts/#{user.id}/following")
@@ -615,7 +663,7 @@ test "getting following", %{user: user, conn: conn} do
test "getting following, hide_follows, other user requesting" do
user = insert(:user, hide_follows: true)
other_user = insert(:user)
- {:ok, user} = User.follow(user, other_user)
+ {:ok, user, other_user} = User.follow(user, other_user)
conn =
build_conn()
@@ -629,7 +677,7 @@ test "getting following, hide_follows, other user requesting" do
test "getting following, hide_follows, same user requesting" do
user = insert(:user, hide_follows: true)
other_user = insert(:user)
- {:ok, user} = User.follow(user, other_user)
+ {:ok, user, _other_user} = User.follow(user, other_user)
conn =
build_conn()
@@ -644,9 +692,9 @@ test "getting following, pagination", %{user: user, conn: conn} do
following1 = insert(:user)
following2 = insert(:user)
following3 = insert(:user)
- {:ok, _} = User.follow(user, following1)
- {:ok, _} = User.follow(user, following2)
- {:ok, _} = User.follow(user, following3)
+ {:ok, _, _} = User.follow(user, following1)
+ {:ok, _, _} = User.follow(user, following2)
+ {:ok, _, _} = User.follow(user, following3)
res_conn = get(conn, "/api/v1/accounts/#{user.id}/following?since_id=#{following1.id}")
@@ -1378,8 +1426,6 @@ test "creates an account and returns 200 if captcha is valid", %{conn: conn} do
|> json_response_and_validate_schema(:ok)
assert Token |> Repo.get_by(token: access_token) |> Repo.preload(:user) |> Map.get(:user)
-
- Cachex.del(:used_captcha_cache, token)
end
test "returns 400 if any captcha field is not provided", %{conn: conn} do
@@ -1487,7 +1533,7 @@ test "locked accounts" do
test "returns the relationships for the current user", %{user: user, conn: conn} do
%{id: other_user_id} = other_user = insert(:user)
- {:ok, _user} = User.follow(user, other_user)
+ {:ok, _user, _other_user} = User.follow(user, other_user)
assert [%{"id" => ^other_user_id}] =
conn
diff --git a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs
index bf2438fe2..ce957054b 100644
--- a/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/auth_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.AuthControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Config
alias Pleroma.Repo
@@ -39,7 +39,7 @@ test "redirects to the saved path after log in", %{conn: conn, path: path} do
|> get("/web/login", %{code: auth.token})
assert conn.status == 302
- assert redirected_to(conn) == path
+ assert redirected_to(conn) =~ path
end
test "redirects to the getting-started page when referer is not present", %{conn: conn} do
@@ -49,7 +49,7 @@ test "redirects to the getting-started page when referer is not present", %{conn
conn = get(conn, "/web/login", %{code: auth.token})
assert conn.status == 302
- assert redirected_to(conn) == "/web/getting-started"
+ assert redirected_to(conn) =~ "/web/getting-started"
end
end
diff --git a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs
index c67e584dd..a03513e06 100644
--- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Conversation.Participation
alias Pleroma.User
@@ -18,7 +18,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
user_two = insert(:user)
user_three = insert(:user)
- {:ok, user_two} = User.follow(user_two, user_one)
+ {:ok, user_two, user_one} = User.follow(user_two, user_one)
{:ok, %{user: user_one, user_two: user_two, user_three: user_three, conn: conn}}
end
diff --git a/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs
index 664654500..b10aa6966 100644
--- a/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/domain_block_controller_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.DomainBlockControllerTest do
+ # TODO: Should not need Cachex
use Pleroma.Web.ConnCase
alias Pleroma.User
diff --git a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs
index 0d426ec34..e639cdde1 100644
--- a/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/filter_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.MastodonAPI.FilterView
diff --git a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
index a9dd7cd30..f0a466212 100644
--- a/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/follow_request_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.User
alias Pleroma.Web.CommonAPI
@@ -21,7 +21,7 @@ test "/api/v1/follow_requests works", %{user: user, conn: conn} do
other_user = insert(:user)
{:ok, _, _, _activity} = CommonAPI.follow(other_user, user)
- {:ok, other_user} = User.follow(other_user, user, :follow_pending)
+ {:ok, other_user, user} = User.follow(other_user, user, :follow_pending)
assert User.following?(other_user, user) == false
@@ -35,7 +35,7 @@ test "/api/v1/follow_requests/:id/authorize works", %{user: user, conn: conn} do
other_user = insert(:user)
{:ok, _, _, _activity} = CommonAPI.follow(other_user, user)
- {:ok, other_user} = User.follow(other_user, user, :follow_pending)
+ {:ok, other_user, user} = User.follow(other_user, user, :follow_pending)
user = User.get_cached_by_id(user.id)
other_user = User.get_cached_by_id(other_user.id)
diff --git a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs
index 6a9ccd979..71a170240 100644
--- a/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/instance_controller_test.exs
@@ -3,6 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
+ # TODO: Should not need Cachex
use Pleroma.Web.ConnCase
alias Pleroma.User
@@ -13,6 +14,9 @@ test "get instance information", %{conn: conn} do
assert result = json_response_and_validate_schema(conn, 200)
email = Pleroma.Config.get([:instance, :email])
+ thumbnail = Pleroma.Web.base_url() <> Pleroma.Config.get([:instance, :instance_thumbnail])
+ background = Pleroma.Web.base_url() <> Pleroma.Config.get([:instance, :background_image])
+
# Note: not checking for "max_toot_chars" since it's optional
assert %{
"uri" => _,
@@ -24,7 +28,7 @@ test "get instance information", %{conn: conn} do
"streaming_api" => _
},
"stats" => _,
- "thumbnail" => _,
+ "thumbnail" => from_config_thumbnail,
"languages" => _,
"registrations" => _,
"approval_required" => _,
@@ -33,7 +37,7 @@ test "get instance information", %{conn: conn} do
"avatar_upload_limit" => _,
"background_upload_limit" => _,
"banner_upload_limit" => _,
- "background_image" => _,
+ "background_image" => from_config_background,
"chat_limit" => _,
"description_limit" => _
} = result
@@ -45,6 +49,8 @@ test "get instance information", %{conn: conn} do
assert result["pleroma"]["vapid_public_key"]
assert email == from_config_email
+ assert thumbnail == from_config_thumbnail
+ assert background == from_config_background
end
test "get instance stats", %{conn: conn} do
diff --git a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs
index 091ec006c..01f64cfcc 100644
--- a/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/list_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Repo
diff --git a/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs
index 9f0481120..ee944a67c 100644
--- a/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/marker_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
diff --git a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs
index 70ef0e8b5..9ac8488f6 100644
--- a/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/notification_controller_test.exs
@@ -75,6 +75,34 @@ test "by default, does not contain pleroma:chat_mention" do
assert [_] = result
end
+ test "by default, does not contain pleroma:report" do
+ %{user: user, conn: conn} = oauth_access(["read:notifications"])
+ other_user = insert(:user)
+ third_user = insert(:user)
+
+ user
+ |> User.admin_api_update(%{is_moderator: true})
+
+ {:ok, activity} = CommonAPI.post(other_user, %{status: "hey"})
+
+ {:ok, _report} =
+ CommonAPI.report(third_user, %{account_id: other_user.id, status_ids: [activity.id]})
+
+ result =
+ conn
+ |> get("/api/v1/notifications")
+ |> json_response_and_validate_schema(200)
+
+ assert [] == result
+
+ result =
+ conn
+ |> get("/api/v1/notifications?include_types[]=pleroma:report")
+ |> json_response_and_validate_schema(200)
+
+ assert [_] = result
+ end
+
test "getting a single notification" do
%{user: user, conn: conn} = oauth_access(["read:notifications"])
other_user = insert(:user)
@@ -502,7 +530,7 @@ test "see notifications after muting user without notifications" do
assert length(json_response_and_validate_schema(ret_conn, 200)) == 1
- {:ok, _user_relationships} = User.mute(user, user2, false)
+ {:ok, _user_relationships} = User.mute(user, user2, %{notifications: false})
conn = get(conn, "/api/v1/notifications")
diff --git a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs
index f41de6448..95e27623d 100644
--- a/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/poll_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.PollControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Object
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs
index 6636cff96..322eb475c 100644
--- a/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/report_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ReportControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
index 04dc6f445..1045ab265 100644
--- a/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/search_controller_test.exs
@@ -279,6 +279,10 @@ test "search", %{conn: conn} do
end
test "search fetches remote statuses and prefers them over other results", %{conn: conn} do
+ old_version = :persistent_term.get({Pleroma.Repo, :postgres_version})
+ :persistent_term.put({Pleroma.Repo, :postgres_version}, 10.0)
+ on_exit(fn -> :persistent_term.put({Pleroma.Repo, :postgres_version}, old_version) end)
+
capture_log(fn ->
{:ok, %{id: activity_id}} =
CommonAPI.post(insert(:user), %{
diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
index 436608e51..de542e5df 100644
--- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
@@ -67,10 +67,6 @@ test "posting a status", %{conn: conn} do
"sensitive" => "0"
})
- {:ok, ttl} = Cachex.ttl(:idempotency_cache, idempotency_key)
- # Six hours
- assert ttl > :timer.seconds(6 * 60 * 60 - 1)
-
assert %{"content" => "cofe", "id" => id, "spoiler_text" => "2hu", "sensitive" => false} =
json_response_and_validate_schema(conn_one, 200)
@@ -328,7 +324,7 @@ test "fake statuses' preview card is not cached", %{conn: conn} do
end
test "posting a status with OGP link preview", %{conn: conn} do
- Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
clear_config([:rich_media, :enabled], true)
conn =
@@ -1197,7 +1193,7 @@ test "on pin removes deletion job, on unpin reschedule deletion" do
end
test "returns rich-media card", %{conn: conn, user: user} do
- Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
{:ok, activity} = CommonAPI.post(user, %{status: "https://example.com/ogp"})
@@ -1242,7 +1238,7 @@ test "returns rich-media card", %{conn: conn, user: user} do
end
test "replaces missing description with an empty string", %{conn: conn, user: user} do
- Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
+ Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
{:ok, activity} = CommonAPI.post(user, %{status: "https://example.com/ogp-missing-data"})
@@ -1740,4 +1736,94 @@ test "expires_at is nil for another user" do
|> get("/api/v1/statuses/#{activity.id}")
|> json_response_and_validate_schema(:ok)
end
+
+ test "posting a local only status" do
+ %{user: _user, conn: conn} = oauth_access(["write:statuses"])
+
+ conn_one =
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/v1/statuses", %{
+ "status" => "cofe",
+ "visibility" => "local"
+ })
+
+ local = Pleroma.Constants.as_local_public()
+
+ assert %{"content" => "cofe", "id" => id, "visibility" => "local"} =
+ json_response(conn_one, 200)
+
+ assert %Activity{id: ^id, data: %{"to" => [^local]}} = Activity.get_by_id(id)
+ end
+
+ describe "muted reactions" do
+ test "index" do
+ %{conn: conn, user: user} = oauth_access(["read:statuses"])
+
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "test"})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ User.mute(user, other_user)
+
+ result =
+ conn
+ |> get("/api/v1/statuses/?ids[]=#{activity.id}")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> get("/api/v1/statuses/?ids[]=#{activity.id}&with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
+
+ test "show" do
+ # %{conn: conn, user: user, token: token} = oauth_access(["read:statuses"])
+ %{conn: conn, user: user, token: _token} = oauth_access(["read:statuses"])
+
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "test"})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ User.mute(user, other_user)
+
+ result =
+ conn
+ |> get("/api/v1/statuses/#{activity.id}")
+ |> json_response_and_validate_schema(200)
+
+ assert %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ } = result
+
+ result =
+ conn
+ |> get("/api/v1/statuses/#{activity.id}?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ } = result
+ end
+ end
end
diff --git a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
index d36bb1ae8..4bb085750 100644
--- a/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/subscription_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
@@ -45,21 +45,77 @@ defmacro assert_error_when_disable_push(do: yield) do
end
end
- describe "creates push subscription" do
- test "returns error when push disabled ", %{conn: conn} do
+ describe "when disabled" do
+ test "POST returns error", %{conn: conn} do
assert_error_when_disable_push do
conn
- |> post("/api/v1/push/subscription", %{subscription: @sub})
+ |> post("/api/v1/push/subscription", %{
+ "data" => %{"alerts" => %{"mention" => true}},
+ "subscription" => @sub
+ })
|> json_response_and_validate_schema(403)
end
end
+ test "GET returns error", %{conn: conn} do
+ assert_error_when_disable_push do
+ conn
+ |> get("/api/v1/push/subscription", %{})
+ |> json_response_and_validate_schema(403)
+ end
+ end
+
+ test "PUT returns error", %{conn: conn} do
+ assert_error_when_disable_push do
+ conn
+ |> put("/api/v1/push/subscription", %{data: %{"alerts" => %{"mention" => false}}})
+ |> json_response_and_validate_schema(403)
+ end
+ end
+
+ test "DELETE returns error", %{conn: conn} do
+ assert_error_when_disable_push do
+ conn
+ |> delete("/api/v1/push/subscription", %{})
+ |> json_response_and_validate_schema(403)
+ end
+ end
+ end
+
+ describe "creates push subscription" do
+ test "ignores unsupported types", %{conn: conn} do
+ result =
+ conn
+ |> post("/api/v1/push/subscription", %{
+ "data" => %{
+ "alerts" => %{
+ "fake_unsupported_type" => true
+ }
+ },
+ "subscription" => @sub
+ })
+ |> json_response_and_validate_schema(200)
+
+ refute %{
+ "alerts" => %{
+ "fake_unsupported_type" => true
+ }
+ } == result
+ end
+
test "successful creation", %{conn: conn} do
result =
conn
|> post("/api/v1/push/subscription", %{
"data" => %{
- "alerts" => %{"mention" => true, "test" => true, "pleroma:chat_mention" => true}
+ "alerts" => %{
+ "mention" => true,
+ "favourite" => true,
+ "follow" => true,
+ "reblog" => true,
+ "pleroma:chat_mention" => true,
+ "pleroma:emoji_reaction" => true
+ }
},
"subscription" => @sub
})
@@ -68,7 +124,14 @@ test "successful creation", %{conn: conn} do
[subscription] = Pleroma.Repo.all(Subscription)
assert %{
- "alerts" => %{"mention" => true, "pleroma:chat_mention" => true},
+ "alerts" => %{
+ "mention" => true,
+ "favourite" => true,
+ "follow" => true,
+ "reblog" => true,
+ "pleroma:chat_mention" => true,
+ "pleroma:emoji_reaction" => true
+ },
"endpoint" => subscription.endpoint,
"id" => to_string(subscription.id),
"server_key" => @server_key
@@ -77,14 +140,6 @@ test "successful creation", %{conn: conn} do
end
describe "gets a user subscription" do
- test "returns error when push disabled ", %{conn: conn} do
- assert_error_when_disable_push do
- conn
- |> get("/api/v1/push/subscription", %{})
- |> json_response_and_validate_schema(403)
- end
- end
-
test "returns error when user hasn't subscription", %{conn: conn} do
res =
conn
@@ -124,30 +179,47 @@ test "returns a user subsciption", %{conn: conn, user: user, token: token} do
insert(:push_subscription,
user: user,
token: token,
- data: %{"alerts" => %{"mention" => true}}
+ data: %{
+ "alerts" => %{
+ "mention" => true,
+ "favourite" => true,
+ "follow" => true,
+ "reblog" => true,
+ "pleroma:chat_mention" => true,
+ "pleroma:emoji_reaction" => true
+ }
+ }
)
%{conn: conn, user: user, token: token, subscription: subscription}
end
- test "returns error when push disabled ", %{conn: conn} do
- assert_error_when_disable_push do
- conn
- |> put("/api/v1/push/subscription", %{data: %{"alerts" => %{"mention" => false}}})
- |> json_response_and_validate_schema(403)
- end
- end
-
test "returns updated subsciption", %{conn: conn, subscription: subscription} do
res =
conn
|> put("/api/v1/push/subscription", %{
- data: %{"alerts" => %{"mention" => false, "follow" => true}}
+ data: %{
+ "alerts" => %{
+ "mention" => false,
+ "favourite" => false,
+ "follow" => false,
+ "reblog" => false,
+ "pleroma:chat_mention" => false,
+ "pleroma:emoji_reaction" => false
+ }
+ }
})
|> json_response_and_validate_schema(200)
expect = %{
- "alerts" => %{"follow" => true, "mention" => false},
+ "alerts" => %{
+ "mention" => false,
+ "favourite" => false,
+ "follow" => false,
+ "reblog" => false,
+ "pleroma:chat_mention" => false,
+ "pleroma:emoji_reaction" => false
+ },
"endpoint" => "https://example.com/example/1234",
"id" => to_string(subscription.id),
"server_key" => @server_key
@@ -158,14 +230,6 @@ test "returns updated subsciption", %{conn: conn, subscription: subscription} do
end
describe "deletes the user subscription" do
- test "returns error when push disabled ", %{conn: conn} do
- assert_error_when_disable_push do
- conn
- |> delete("/api/v1/push/subscription", %{})
- |> json_response_and_validate_schema(403)
- end
- end
-
test "returns error when user hasn't subscription", %{conn: conn} do
res =
conn
diff --git a/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs
index 7f08e187c..c3471266a 100644
--- a/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/suggestion_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
setup do: oauth_access(["read"])
diff --git a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs
index c6d72f6cc..d69eaf9b1 100644
--- a/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/timeline_controller_test.exs
@@ -54,6 +54,42 @@ test "the home timeline when the direct messages are excluded", %{user: user, co
assert private_activity.id in status_ids
refute direct_activity.id in status_ids
end
+
+ test "muted emotions", %{user: user, conn: conn} do
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "."})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ User.mute(user, other_user)
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/timelines/home")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> get("/api/v1/timelines/home?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
end
describe "public" do
@@ -100,7 +136,7 @@ test "the public timeline includes only public statuses for an authenticated use
test "doesn't return replies if follower is posting with blocked user" do
%{conn: conn, user: blocker} = oauth_access(["read:statuses"])
[blockee, friend] = insert_list(2, :user)
- {:ok, blocker} = User.follow(blocker, friend)
+ {:ok, blocker, friend} = User.follow(blocker, friend)
{:ok, _} = User.block(blocker, blockee)
conn = assign(conn, :user, blocker)
@@ -147,7 +183,7 @@ test "doesn't return replies if follow is posting with users from blocked domain
%{conn: conn, user: blocker} = oauth_access(["read:statuses"])
friend = insert(:user)
blockee = insert(:user, ap_id: "https://example.com/users/blocked")
- {:ok, blocker} = User.follow(blocker, friend)
+ {:ok, blocker, friend} = User.follow(blocker, friend)
{:ok, blocker} = User.block_domain(blocker, "example.com")
conn = assign(conn, :user, blocker)
@@ -177,6 +213,48 @@ test "can be filtered by instance", %{conn: conn} do
assert length(json_response_and_validate_schema(conn, :ok)) == 1
end
+
+ test "muted emotions", %{conn: conn} do
+ user = insert(:user)
+ token = insert(:oauth_token, user: user, scopes: ["read:statuses"])
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> assign(:token, token)
+
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "."})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ User.mute(user, other_user)
+
+ result =
+ conn
+ |> get("/api/v1/timelines/public")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> get("/api/v1/timelines/public?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
end
defp local_and_remote_activities do
@@ -276,7 +354,7 @@ test "direct timeline", %{conn: conn} do
user_one = insert(:user)
user_two = insert(:user)
- {:ok, user_two} = User.follow(user_two, user_one)
+ {:ok, user_two, user_one} = User.follow(user_two, user_one)
{:ok, direct} =
CommonAPI.post(user_one, %{
@@ -446,6 +524,44 @@ test "list timeline does not leak non-public statuses for unfollowed users", %{
assert id == to_string(activity_one.id)
end
+
+ test "muted emotions", %{user: user, conn: conn} do
+ user2 = insert(:user)
+ user3 = insert(:user)
+ {:ok, activity} = CommonAPI.post(user2, %{status: "."})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user3, "🎅")
+ User.mute(user, user3)
+
+ {:ok, list} = Pleroma.List.create("name", user)
+ {:ok, list} = Pleroma.List.follow(list, user2)
+
+ result =
+ conn
+ |> get("/api/v1/timelines/list/#{list.id}")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> get("/api/v1/timelines/list/#{list.id}?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
end
describe "hashtag" do
@@ -494,6 +610,48 @@ test "multi-hashtag timeline", %{conn: conn} do
assert [status_none] == json_response_and_validate_schema(all_test, :ok)
end
+
+ test "muted emotions", %{conn: conn} do
+ user = insert(:user)
+ token = insert(:oauth_token, user: user, scopes: ["read:statuses"])
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> assign(:token, token)
+
+ other_user = insert(:user)
+ {:ok, activity} = CommonAPI.post(user, %{status: "test #2hu"})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "🎅")
+ User.mute(user, other_user)
+
+ result =
+ conn
+ |> get("/api/v1/timelines/tag/2hu")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => []
+ }
+ }
+ ] = result
+
+ result =
+ conn
+ |> get("/api/v1/timelines/tag/2hu?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [
+ %{
+ "pleroma" => %{
+ "emoji_reactions" => [%{"count" => 1, "me" => false, "name" => "🎅"}]
+ }
+ }
+ ] = result
+ end
end
describe "hashtag timeline handling of :restrict_unauthenticated setting" do
diff --git a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs
index ed8add8d2..b9cd050df 100644
--- a/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/masto_fe_controller_test.exs
@@ -64,7 +64,8 @@ test "redirects not logged-in users to the login page on private instances", %{
end
test "does not redirect logged in users to the login page", %{conn: conn, path: path} do
- token = insert(:oauth_token, scopes: ["read"])
+ {:ok, app} = Pleroma.Web.MastodonAPI.AuthController.local_mastofe_app()
+ token = insert(:oauth_token, app: app, scopes: ["read"])
conn =
conn
diff --git a/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs
index bb4bc4396..be5bf68a3 100644
--- a/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/mastodon_api_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
describe "empty_array/2 (stubs)" do
test "GET /api/v1/accounts/:id/identity_proofs" do
diff --git a/test/pleroma/web/mastodon_api/mastodon_api_test.exs b/test/pleroma/web/mastodon_api/mastodon_api_test.exs
index 0c5a38bf6..cf7f464be 100644
--- a/test/pleroma/web/mastodon_api/mastodon_api_test.exs
+++ b/test/pleroma/web/mastodon_api/mastodon_api_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.MastodonAPITest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Notification
alias Pleroma.ScheduledActivity
@@ -30,7 +30,7 @@ test "following for user" do
test "returns ok if user already followed" do
follower = insert(:user)
user = insert(:user)
- {:ok, follower} = User.follow(follower, user)
+ {:ok, follower, user} = User.follow(follower, user)
{:ok, follower} = MastodonAPI.follow(follower, refresh_record(user))
assert User.following?(follower, user)
end
@@ -41,8 +41,8 @@ test "returns user followers" do
follower1_user = insert(:user)
follower2_user = insert(:user)
user = insert(:user)
- {:ok, _follower1_user} = User.follow(follower1_user, user)
- {:ok, follower2_user} = User.follow(follower2_user, user)
+ {:ok, _follower1_user, _user} = User.follow(follower1_user, user)
+ {:ok, follower2_user, _user} = User.follow(follower2_user, user)
assert MastodonAPI.get_followers(user, %{"limit" => 1}) == [follower2_user]
end
@@ -55,9 +55,9 @@ test "returns user friends" do
followed_two = insert(:user)
followed_three = insert(:user)
- {:ok, user} = User.follow(user, followed_one)
- {:ok, user} = User.follow(user, followed_two)
- {:ok, user} = User.follow(user, followed_three)
+ {:ok, user, followed_one} = User.follow(user, followed_one)
+ {:ok, user, followed_two} = User.follow(user, followed_two)
+ {:ok, user, followed_three} = User.follow(user, followed_three)
res = MastodonAPI.get_friends(user)
assert length(res) == 3
diff --git a/test/pleroma/web/mastodon_api/update_credentials_test.exs b/test/pleroma/web/mastodon_api/update_credentials_test.exs
index ed1921c91..e3e437a19 100644
--- a/test/pleroma/web/mastodon_api/update_credentials_test.exs
+++ b/test/pleroma/web/mastodon_api/update_credentials_test.exs
@@ -11,8 +11,6 @@ defmodule Pleroma.Web.MastodonAPI.UpdateCredentialsTest do
import Mock
import Pleroma.Factory
- setup do: clear_config([:instance, :max_account_fields])
-
describe "updating credentials" do
setup do: oauth_access(["write:accounts"])
setup :request_content_type
@@ -220,6 +218,25 @@ test "updates the user's name", %{conn: conn} do
assert update_activity.data["object"]["name"] == "markorepairs"
end
+ test "updates the user's AKAs", %{conn: conn} do
+ conn =
+ patch(conn, "/api/v1/accounts/update_credentials", %{
+ "also_known_as" => ["https://mushroom.kingdom/users/mario"]
+ })
+
+ assert user_data = json_response_and_validate_schema(conn, 200)
+ assert user_data["pleroma"]["also_known_as"] == ["https://mushroom.kingdom/users/mario"]
+ end
+
+ test "doesn't update non-url akas", %{conn: conn} do
+ conn =
+ patch(conn, "/api/v1/accounts/update_credentials", %{
+ "also_known_as" => ["aReallyCoolGuy"]
+ })
+
+ assert json_response_and_validate_schema(conn, 403)
+ end
+
test "updates the user's avatar", %{user: user, conn: conn} do
new_avatar = %Plug.Upload{
content_type: "image/jpeg",
@@ -446,7 +463,7 @@ test "update fields when invalid request", %{conn: conn} do
|> patch("/api/v1/accounts/update_credentials", %{"fields_attributes" => fields})
|> json_response_and_validate_schema(403)
- Pleroma.Config.put([:instance, :max_account_fields], 1)
+ clear_config([:instance, :max_account_fields], 1)
fields = [
%{"name" => "foo", "value" => "bar"},
diff --git a/test/pleroma/web/mastodon_api/views/account_view_test.exs b/test/pleroma/web/mastodon_api/views/account_view_test.exs
index 203e61c71..f9afd0afc 100644
--- a/test/pleroma/web/mastodon_api/views/account_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/account_view_test.exs
@@ -35,7 +35,8 @@ test "Represent a user account" do
"valid html . a b c d f '&<>\"",
inserted_at: ~N[2017-08-15 15:47:06.597036],
emoji: %{"karjalanpiirakka" => "/file.png"},
- raw_bio: "valid html. a\nb\nc\nd\nf '&<>\""
+ raw_bio: "valid html. a\nb\nc\nd\nf '&<>\"",
+ also_known_as: ["https://shitposter.zone/users/shp"]
})
expected = %{
@@ -75,6 +76,7 @@ test "Represent a user account" do
},
pleroma: %{
ap_id: user.ap_id,
+ also_known_as: ["https://shitposter.zone/users/shp"],
background_image: "https://example.com/images/asuka_hospital.png",
favicon: nil,
confirmation_pending: false,
@@ -173,6 +175,7 @@ test "Represent a Service(bot) account" do
},
pleroma: %{
ap_id: user.ap_id,
+ also_known_as: [],
background_image: nil,
favicon: nil,
confirmation_pending: false,
@@ -274,10 +277,10 @@ test "represent a relationship for the following and followed user" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user} = User.follow(user, other_user)
- {:ok, other_user} = User.follow(other_user, user)
+ {:ok, user, other_user} = User.follow(user, other_user)
+ {:ok, other_user, user} = User.follow(other_user, user)
{:ok, _subscription} = User.subscribe(user, other_user)
- {:ok, _user_relationships} = User.mute(user, other_user, true)
+ {:ok, _user_relationships} = User.mute(user, other_user, %{notifications: true})
{:ok, _reblog_mute} = CommonAPI.hide_reblogs(user, other_user)
expected =
@@ -301,7 +304,7 @@ test "represent a relationship for the blocking and blocked user" do
user = insert(:user)
other_user = insert(:user)
- {:ok, user} = User.follow(user, other_user)
+ {:ok, user, other_user} = User.follow(user, other_user)
{:ok, _subscription} = User.subscribe(user, other_user)
{:ok, _user_relationship} = User.block(user, other_user)
{:ok, _user_relationship} = User.block(other_user, user)
diff --git a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs
index 20c10ba3d..f02253b68 100644
--- a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ConversationViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Conversation.Participation
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/web/mastodon_api/views/list_view_test.exs b/test/pleroma/web/mastodon_api/views/list_view_test.exs
index ca99242cb..377941332 100644
--- a/test/pleroma/web/mastodon_api/views/list_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/list_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ListViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.MastodonAPI.ListView
diff --git a/test/pleroma/web/mastodon_api/views/marker_view_test.exs b/test/pleroma/web/mastodon_api/views/marker_view_test.exs
index 48a0a6d33..a0bec758f 100644
--- a/test/pleroma/web/mastodon_api/views/marker_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/marker_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.MarkerViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.MastodonAPI.MarkerView
import Pleroma.Factory
diff --git a/test/pleroma/web/mastodon_api/views/notification_view_test.exs b/test/pleroma/web/mastodon_api/views/notification_view_test.exs
index 2f6a808f1..9de11a87e 100644
--- a/test/pleroma/web/mastodon_api/views/notification_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/notification_view_test.exs
@@ -12,6 +12,8 @@ defmodule Pleroma.Web.MastodonAPI.NotificationViewTest do
alias Pleroma.Object
alias Pleroma.Repo
alias Pleroma.User
+ alias Pleroma.Web.AdminAPI.Report
+ alias Pleroma.Web.AdminAPI.ReportView
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.CommonAPI.Utils
alias Pleroma.Web.MastodonAPI.AccountView
@@ -207,6 +209,26 @@ test "EmojiReact notification" do
test_notifications_rendering([notification], user, [expected])
end
+ test "Report notification" do
+ reporting_user = insert(:user)
+ reported_user = insert(:user)
+ {:ok, moderator_user} = insert(:user) |> User.admin_api_update(%{is_moderator: true})
+
+ {:ok, activity} = CommonAPI.report(reporting_user, %{account_id: reported_user.id})
+ {:ok, [notification]} = Notification.create_notifications(activity)
+
+ expected = %{
+ id: to_string(notification.id),
+ pleroma: %{is_seen: false, is_muted: false},
+ type: "pleroma:report",
+ account: AccountView.render("show.json", %{user: reporting_user, for: moderator_user}),
+ created_at: Utils.to_masto_date(notification.inserted_at),
+ report: ReportView.render("show.json", Report.extract_report_info(activity))
+ }
+
+ test_notifications_rendering([notification], moderator_user, [expected])
+ end
+
test "muted notification" do
user = insert(:user)
another_user = insert(:user)
diff --git a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs
index 04f73f5a0..c41ac7f7f 100644
--- a/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/scheduled_activity_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.ScheduledActivityViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.ScheduledActivity
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/web/mastodon_api/views/status_view_test.exs b/test/pleroma/web/mastodon_api/views/status_view_test.exs
index 70d829979..fa9066716 100644
--- a/test/pleroma/web/mastodon_api/views/status_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/status_view_test.exs
@@ -73,6 +73,50 @@ test "works correctly with badly formatted emojis" do
]
end
+ test "doesn't show reactions from muted and blocked users" do
+ user = insert(:user)
+ other_user = insert(:user)
+ third_user = insert(:user)
+
+ {:ok, activity} = CommonAPI.post(user, %{status: "dae cofe??"})
+
+ {:ok, _} = User.mute(user, other_user)
+ {:ok, _} = User.block(other_user, third_user)
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, other_user, "☕")
+
+ activity = Repo.get(Activity, activity.id)
+ status = StatusView.render("show.json", activity: activity)
+
+ assert status[:pleroma][:emoji_reactions] == [
+ %{name: "☕", count: 1, me: false}
+ ]
+
+ status = StatusView.render("show.json", activity: activity, for: user)
+
+ assert status[:pleroma][:emoji_reactions] == []
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, third_user, "☕")
+
+ status = StatusView.render("show.json", activity: activity)
+
+ assert status[:pleroma][:emoji_reactions] == [
+ %{name: "☕", count: 2, me: false}
+ ]
+
+ status = StatusView.render("show.json", activity: activity, for: user)
+
+ assert status[:pleroma][:emoji_reactions] == [
+ %{name: "☕", count: 1, me: false}
+ ]
+
+ status = StatusView.render("show.json", activity: activity, for: other_user)
+
+ assert status[:pleroma][:emoji_reactions] == [
+ %{name: "☕", count: 1, me: true}
+ ]
+ end
+
test "loads and returns the direct conversation id when given the `with_direct_conversation_id` option" do
user = insert(:user)
@@ -116,7 +160,7 @@ test "returns a temporary ap_id based user for activities missing db users" do
{:ok, activity} = CommonAPI.post(user, %{status: "Hey @shp!", visibility: "direct"})
Repo.delete(user)
- Cachex.clear(:user_cache)
+ User.invalidate_cache(user)
finger_url =
"https://localhost/.well-known/webfinger?resource=acct:#{user.nickname}@localhost"
@@ -150,7 +194,7 @@ test "tries to get a user by nickname if fetching by ap_id doesn't work" do
|> Ecto.Changeset.change(%{ap_id: "#{user.ap_id}/extension/#{user.nickname}"})
|> Repo.update()
- Cachex.clear(:user_cache)
+ User.invalidate_cache(user)
result = StatusView.render("show.json", activity: activity)
@@ -420,6 +464,7 @@ test "attachments" do
"href" => "someurl"
}
],
+ "blurhash" => "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn",
"uuid" => 6
}
@@ -431,7 +476,8 @@ test "attachments" do
preview_url: "someurl",
text_url: "someurl",
description: nil,
- pleroma: %{mime_type: "image/png"}
+ pleroma: %{mime_type: "image/png"},
+ blurhash: "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn"
}
api_spec = Pleroma.Web.ApiSpec.spec()
diff --git a/test/pleroma/web/mastodon_api/views/subscription_view_test.exs b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
index 981524c0e..c2bb535c5 100644
--- a/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
+++ b/test/pleroma/web/mastodon_api/views/subscription_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.SubscriptionViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.MastodonAPI.SubscriptionView, as: View
alias Pleroma.Web.Push
diff --git a/test/pleroma/web/media_proxy/invalidation/http_test.exs b/test/pleroma/web/media_proxy/invalidation/http_test.exs
index 13d081325..c81010423 100644
--- a/test/pleroma/web/media_proxy/invalidation/http_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation/http_test.exs
@@ -9,10 +9,6 @@ defmodule Pleroma.Web.MediaProxy.Invalidation.HttpTest do
import ExUnit.CaptureLog
import Tesla.Mock
- setup do
- on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
- end
-
test "logs hasn't error message when request is valid" do
mock(fn
%{method: :purge, url: "http://example.com/media/example.jpg"} ->
diff --git a/test/pleroma/web/media_proxy/invalidation/script_test.exs b/test/pleroma/web/media_proxy/invalidation/script_test.exs
index 692cbb2df..6940a4539 100644
--- a/test/pleroma/web/media_proxy/invalidation/script_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation/script_test.exs
@@ -3,15 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MediaProxy.Invalidation.ScriptTest do
- use ExUnit.Case
+ use ExUnit.Case, async: true
alias Pleroma.Web.MediaProxy.Invalidation
import ExUnit.CaptureLog
- setup do
- on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
- end
-
test "it logger error when script not found" do
assert capture_log(fn ->
assert Invalidation.Script.purge(
diff --git a/test/pleroma/web/media_proxy/invalidation_test.exs b/test/pleroma/web/media_proxy/invalidation_test.exs
index aa1435ac0..b7be36b47 100644
--- a/test/pleroma/web/media_proxy/invalidation_test.exs
+++ b/test/pleroma/web/media_proxy/invalidation_test.exs
@@ -3,8 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MediaProxy.InvalidationTest do
- use ExUnit.Case
- use Pleroma.Tests.Helpers
+ use Pleroma.DataCase
alias Pleroma.Config
alias Pleroma.Web.MediaProxy.Invalidation
@@ -15,10 +14,6 @@ defmodule Pleroma.Web.MediaProxy.InvalidationTest do
setup do: clear_config([:media_proxy])
- setup do
- on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
- end
-
describe "Invalidation.Http" do
test "perform request to clear cache" do
Config.put([:media_proxy, :enabled], false)
diff --git a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs
index e9b584822..65cf2a01b 100644
--- a/test/pleroma/web/media_proxy/media_proxy_controller_test.exs
+++ b/test/pleroma/web/media_proxy/media_proxy_controller_test.exs
@@ -10,10 +10,6 @@ defmodule Pleroma.Web.MediaProxy.MediaProxyControllerTest do
alias Pleroma.Web.MediaProxy
alias Plug.Conn
- setup do
- on_exit(fn -> Cachex.clear(:banned_urls_cache) end)
- end
-
describe "Media Proxy" do
setup do
clear_config([:media_proxy, :enabled], true)
diff --git a/test/pleroma/web/metadata/player_view_test.exs b/test/pleroma/web/metadata/player_view_test.exs
index e6c990242..6d22317d2 100644
--- a/test/pleroma/web/metadata/player_view_test.exs
+++ b/test/pleroma/web/metadata/player_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.PlayerViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.Metadata.PlayerView
diff --git a/test/pleroma/web/metadata/providers/feed_test.exs b/test/pleroma/web/metadata/providers/feed_test.exs
index e6e5cc5ed..c7359e00b 100644
--- a/test/pleroma/web/metadata/providers/feed_test.exs
+++ b/test/pleroma/web/metadata/providers/feed_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.FeedTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.Metadata.Providers.Feed
diff --git a/test/pleroma/web/metadata/providers/rel_me_test.exs b/test/pleroma/web/metadata/providers/rel_me_test.exs
index 2293d6e13..ae449c052 100644
--- a/test/pleroma/web/metadata/providers/rel_me_test.exs
+++ b/test/pleroma/web/metadata/providers/rel_me_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.Providers.RelMeTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.Metadata.Providers.RelMe
diff --git a/test/pleroma/web/metadata/providers/restrict_indexing_test.exs b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs
index 282d132c8..52399fdc8 100644
--- a/test/pleroma/web/metadata/providers/restrict_indexing_test.exs
+++ b/test/pleroma/web/metadata/providers/restrict_indexing_test.exs
@@ -18,7 +18,7 @@ test "for local user" do
}) == []
end
- test "for local user when discoverable is false" do
+ test "for local user when `is_discoverable` is false" do
assert Pleroma.Web.Metadata.Providers.RestrictIndexing.build_tags(%{
user: %Pleroma.User{local: true, is_discoverable: false}
}) == [{:meta, [name: "robots", content: "noindex, noarchive"], []}]
diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs
index 8183256d8..3794db766 100644
--- a/test/pleroma/web/metadata/utils_test.exs
+++ b/test/pleroma/web/metadata/utils_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Metadata.UtilsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.Metadata.Utils
diff --git a/test/pleroma/web/metadata_test.exs b/test/pleroma/web/metadata_test.exs
deleted file mode 100644
index 8fb946540..000000000
--- a/test/pleroma/web/metadata_test.exs
+++ /dev/null
@@ -1,49 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.MetadataTest do
- use Pleroma.DataCase, async: true
-
- import Pleroma.Factory
-
- describe "restrict indexing remote users" do
- test "for remote user" do
- user = insert(:user, local: false)
-
- assert Pleroma.Web.Metadata.build_tags(%{user: user}) =~
- " "
- end
-
- test "for local user" do
- user = insert(:user, is_discoverable: false)
-
- assert Pleroma.Web.Metadata.build_tags(%{user: user}) =~
- " "
- end
-
- test "for local user set to discoverable" do
- user = insert(:user, is_discoverable: true)
-
- refute Pleroma.Web.Metadata.build_tags(%{user: user}) =~
- " "
- end
- end
-
- describe "no metadata for private instances" do
- test "for local user set to discoverable" do
- clear_config([:instance, :public], false)
- user = insert(:user, bio: "This is my secret fedi account bio", is_discoverable: true)
-
- assert "" = Pleroma.Web.Metadata.build_tags(%{user: user})
- end
-
- test "search exclusion metadata is included" do
- clear_config([:instance, :public], false)
- user = insert(:user, bio: "This is my secret fedi account bio", is_discoverable: false)
-
- assert ~s( ) ==
- Pleroma.Web.Metadata.build_tags(%{user: user})
- end
- end
-end
diff --git a/test/pleroma/web/mongoose_im_controller_test.exs b/test/pleroma/web/mongoose_im_controller_test.exs
index e3a8aa3d8..4590e1296 100644
--- a/test/pleroma/web/mongoose_im_controller_test.exs
+++ b/test/pleroma/web/mongoose_im_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MongooseIMControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
test "/user_exists", %{conn: conn} do
diff --git a/test/pleroma/web/o_auth/app_test.exs b/test/pleroma/web/o_auth/app_test.exs
index 993a490e0..24d7049f1 100644
--- a/test/pleroma/web/o_auth/app_test.exs
+++ b/test/pleroma/web/o_auth/app_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.AppTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.OAuth.App
import Pleroma.Factory
diff --git a/test/pleroma/web/o_auth/authorization_test.exs b/test/pleroma/web/o_auth/authorization_test.exs
index d74b26cf8..d1920962c 100644
--- a/test/pleroma/web/o_auth/authorization_test.exs
+++ b/test/pleroma/web/o_auth/authorization_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.AuthorizationTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.OAuth.App
alias Pleroma.Web.OAuth.Authorization
import Pleroma.Factory
diff --git a/test/pleroma/web/o_auth/mfa_controller_test.exs b/test/pleroma/web/o_auth/mfa_controller_test.exs
index 3c341facd..bc50d8d18 100644
--- a/test/pleroma/web/o_auth/mfa_controller_test.exs
+++ b/test/pleroma/web/o_auth/mfa_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.MFAControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
alias Pleroma.MFA
@@ -171,7 +171,6 @@ test "returns access token with valid code", %{conn: conn, user: user, app: app}
assert match?(
%{
"access_token" => _,
- "expires_in" => 600,
"me" => ^ap_id,
"refresh_token" => _,
"scope" => "write",
@@ -280,7 +279,6 @@ test "returns access token with valid code", %{conn: conn, app: app} do
assert match?(
%{
"access_token" => _,
- "expires_in" => 600,
"me" => ^ap_id,
"refresh_token" => _,
"scope" => "write",
diff --git a/test/pleroma/web/o_auth/o_auth_controller_test.exs b/test/pleroma/web/o_auth/o_auth_controller_test.exs
index a00df8cc7..ac22856ea 100644
--- a/test/pleroma/web/o_auth/o_auth_controller_test.exs
+++ b/test/pleroma/web/o_auth/o_auth_controller_test.exs
@@ -4,8 +4,10 @@
defmodule Pleroma.Web.OAuth.OAuthControllerTest do
use Pleroma.Web.ConnCase
+
import Pleroma.Factory
+ alias Pleroma.Helpers.AuthHelper
alias Pleroma.MFA
alias Pleroma.MFA.TOTP
alias Pleroma.Repo
@@ -81,7 +83,7 @@ test "GET /oauth/prepare_request encodes parameters as `state` and redirects", %
redirect_query = URI.parse(redirected_to(conn)).query
assert %{"state" => state_param} = URI.decode_query(redirect_query)
- assert {:ok, state_components} = Poison.decode(state_param)
+ assert {:ok, state_components} = Jason.decode(state_param)
expected_client_id = app.client_id
expected_redirect_uri = app.redirect_uris
@@ -115,7 +117,7 @@ test "with user-bound registration, GET /oauth//callback redirects to
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
@@ -147,7 +149,7 @@ test "with user-unbound registration, GET /oauth//callback renders reg
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
@@ -178,7 +180,7 @@ test "on authentication error, GET /oauth//callback redirects to `redi
"oauth_token" => "G-5a3AAAAAAAwMH9AAABaektfSM",
"oauth_verifier" => "QZl8vUqNvXMTKpdmUnGejJxuHG75WWWs",
"provider" => "twitter",
- "state" => Poison.encode!(state_params)
+ "state" => Jason.encode!(state_params)
}
)
@@ -454,7 +456,7 @@ test "renders authentication page if user is already authenticated but `force_lo
conn =
conn
- |> put_session(:oauth_token, token.token)
+ |> AuthHelper.put_session_token(token.token)
|> get(
"/oauth/authorize",
%{
@@ -478,7 +480,7 @@ test "renders authentication page if user is already authenticated but user requ
conn =
conn
- |> put_session(:oauth_token, token.token)
+ |> AuthHelper.put_session_token(token.token)
|> get(
"/oauth/authorize",
%{
@@ -501,7 +503,7 @@ test "with existing authentication and non-OOB `redirect_uri`, redirects to app
conn =
conn
- |> put_session(:oauth_token, token.token)
+ |> AuthHelper.put_session_token(token.token)
|> get(
"/oauth/authorize",
%{
@@ -527,7 +529,7 @@ test "with existing authentication and unlisted non-OOB `redirect_uri`, redirect
conn =
conn
- |> put_session(:oauth_token, token.token)
+ |> AuthHelper.put_session_token(token.token)
|> get(
"/oauth/authorize",
%{
@@ -551,7 +553,7 @@ test "with existing authentication and OOB `redirect_uri`, redirects to app with
conn =
conn
- |> put_session(:oauth_token, token.token)
+ |> AuthHelper.put_session_token(token.token)
|> get(
"/oauth/authorize",
%{
@@ -609,6 +611,41 @@ test "redirects with oauth authorization, " <>
end
end
+ test "authorize from cookie" do
+ user = insert(:user)
+ app = insert(:oauth_app)
+ oauth_token = insert(:oauth_token, user: user, app: app)
+ redirect_uri = OAuthController.default_redirect_uri(app)
+
+ conn =
+ build_conn()
+ |> Plug.Session.call(Plug.Session.init(@session_opts))
+ |> fetch_session()
+ |> AuthHelper.put_session_token(oauth_token.token)
+ |> post(
+ "/oauth/authorize",
+ %{
+ "authorization" => %{
+ "name" => user.nickname,
+ "client_id" => app.client_id,
+ "redirect_uri" => redirect_uri,
+ "scope" => app.scopes,
+ "state" => "statepassed"
+ }
+ }
+ )
+
+ target = redirected_to(conn)
+ assert target =~ redirect_uri
+
+ query = URI.parse(target).query |> URI.query_decoder() |> Map.new()
+
+ assert %{"state" => "statepassed", "code" => code} = query
+ auth = Repo.get_by(Authorization, token: code)
+ assert auth
+ assert auth.scopes == app.scopes
+ end
+
test "redirect to on two-factor auth page" do
otp_secret = TOTP.generate_secret()
@@ -1068,7 +1105,6 @@ test "issues a new access token with keep fresh token" do
%{
"scope" => "write",
"token_type" => "Bearer",
- "expires_in" => 600,
"access_token" => _,
"refresh_token" => _,
"me" => ^ap_id
@@ -1108,7 +1144,6 @@ test "issues a new access token with new fresh token" do
%{
"scope" => "write",
"token_type" => "Bearer",
- "expires_in" => 600,
"access_token" => _,
"refresh_token" => _,
"me" => ^ap_id
@@ -1191,7 +1226,6 @@ test "issues a new token if token expired" do
%{
"scope" => "write",
"token_type" => "Bearer",
- "expires_in" => 600,
"access_token" => _,
"refresh_token" => _,
"me" => ^ap_id
@@ -1219,8 +1253,43 @@ test "returns 500" do
end
end
- describe "POST /oauth/revoke - bad request" do
- test "returns 500" do
+ describe "POST /oauth/revoke" do
+ test "when authenticated with request token, revokes it and clears it from session" do
+ oauth_token = insert(:oauth_token)
+
+ conn =
+ build_conn()
+ |> Plug.Session.call(Plug.Session.init(@session_opts))
+ |> fetch_session()
+ |> AuthHelper.put_session_token(oauth_token.token)
+ |> post("/oauth/revoke", %{"token" => oauth_token.token})
+
+ assert json_response(conn, 200)
+
+ refute AuthHelper.get_session_token(conn)
+ assert Token.get_by_token(oauth_token.token) == {:error, :not_found}
+ end
+
+ test "if request is authenticated with a different token, " <>
+ "revokes requested token but keeps session token" do
+ user = insert(:user)
+ oauth_token = insert(:oauth_token, user: user)
+ other_app_oauth_token = insert(:oauth_token, user: user)
+
+ conn =
+ build_conn()
+ |> Plug.Session.call(Plug.Session.init(@session_opts))
+ |> fetch_session()
+ |> AuthHelper.put_session_token(oauth_token.token)
+ |> post("/oauth/revoke", %{"token" => other_app_oauth_token.token})
+
+ assert json_response(conn, 200)
+
+ assert AuthHelper.get_session_token(conn) == oauth_token.token
+ assert Token.get_by_token(other_app_oauth_token.token) == {:error, :not_found}
+ end
+
+ test "returns 500 on bad request" do
response =
build_conn()
|> post("/oauth/revoke", %{})
diff --git a/test/pleroma/web/o_auth/token/utils_test.exs b/test/pleroma/web/o_auth/token/utils_test.exs
index a610d92f8..3444692ec 100644
--- a/test/pleroma/web/o_auth/token/utils_test.exs
+++ b/test/pleroma/web/o_auth/token/utils_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.Token.UtilsTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.OAuth.Token.Utils
import Pleroma.Factory
diff --git a/test/pleroma/web/o_auth/token_test.exs b/test/pleroma/web/o_auth/token_test.exs
index c88b9cc98..866f1c00a 100644
--- a/test/pleroma/web/o_auth/token_test.exs
+++ b/test/pleroma/web/o_auth/token_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.OAuth.TokenTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Repo
alias Pleroma.Web.OAuth.App
alias Pleroma.Web.OAuth.Authorization
diff --git a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs
index c1e6a8cc5..415c3decd 100644
--- a/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/chat_controller_test.exs
@@ -264,9 +264,10 @@ test "it returns the messages for a given chat", %{conn: conn, user: user} do
assert length(result) == 3
# Trying to get the chat of a different user
+ other_user_chat = Chat.get(other_user.id, user.ap_id)
+
conn
- |> assign(:user, other_user)
- |> get("/api/v1/pleroma/chats/#{chat.id}/messages")
+ |> get("/api/v1/pleroma/chats/#{other_user_chat.id}/messages")
|> json_response_and_validate_schema(404)
end
end
@@ -393,11 +394,11 @@ test "it return a list of chats the current user is participating in, in descend
tridi = insert(:user)
{:ok, chat_1} = Chat.get_or_create(user.id, har.ap_id)
- :timer.sleep(1000)
- {:ok, _chat_2} = Chat.get_or_create(user.id, jafnhar.ap_id)
- :timer.sleep(1000)
+ {:ok, chat_1} = time_travel(chat_1, -3)
+ {:ok, chat_2} = Chat.get_or_create(user.id, jafnhar.ap_id)
+ {:ok, _chat_2} = time_travel(chat_2, -2)
{:ok, chat_3} = Chat.get_or_create(user.id, tridi.ap_id)
- :timer.sleep(1000)
+ {:ok, chat_3} = time_travel(chat_3, -1)
# bump the second one
{:ok, chat_2} = Chat.bump_or_create(user.id, jafnhar.ap_id)
diff --git a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs
index f2feeaaef..c8c2433ae 100644
--- a/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/conversation_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ConversationControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Conversation.Participation
alias Pleroma.Repo
diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs
index 82de86ee3..6fbdaec7a 100644
--- a/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/emoji_file_controller_test.exs
@@ -5,6 +5,7 @@
defmodule Pleroma.Web.PleromaAPI.EmojiFileControllerTest do
use Pleroma.Web.ConnCase
+ import Mock
import Tesla.Mock
import Pleroma.Factory
@@ -200,6 +201,31 @@ test "add file with not loaded pack", %{admin_conn: admin_conn} do
}
end
+ test "returns an error on add file when file system is not writable", %{
+ admin_conn: admin_conn
+ } do
+ pack_file = Path.join([@emoji_path, "not_loaded", "pack.json"])
+
+ with_mocks([
+ {File, [:passthrough], [stat: fn ^pack_file -> {:error, :eacces} end]}
+ ]) do
+ assert admin_conn
+ |> put_req_header("content-type", "multipart/form-data")
+ |> post("/api/pleroma/emoji/packs/files?name=not_loaded", %{
+ shortcode: "blank3",
+ filename: "dir/blank.png",
+ file: %Plug.Upload{
+ filename: "blank.png",
+ path: "#{@emoji_path}/test_pack/blank.png"
+ }
+ })
+ |> json_response_and_validate_schema(500) == %{
+ "error" =>
+ "Unexpected error occurred while adding file to pack. (POSIX error: Permission denied)"
+ }
+ end
+ end
+
test "remove file with not loaded pack", %{admin_conn: admin_conn} do
assert admin_conn
|> delete("/api/pleroma/emoji/packs/files?name=not_loaded&shortcode=blank3")
diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs
index 3445f0ca0..d9385389b 100644
--- a/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/emoji_pack_controller_test.exs
@@ -3,8 +3,9 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.EmojiPackControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: false
+ import Mock
import Tesla.Mock
import Pleroma.Factory
@@ -346,7 +347,7 @@ test "other error", %{admin_conn: admin_conn} do
end
end
- describe "PATCH /api/pleroma/emoji/pack?name=:name" do
+ describe "PATCH/update /api/pleroma/emoji/pack?name=:name" do
setup do
pack_file = "#{@emoji_path}/test_pack/pack.json"
original_content = File.read!(pack_file)
@@ -365,6 +366,20 @@ test "other error", %{admin_conn: admin_conn} do
}}
end
+ test "returns error when file system not writable", %{admin_conn: conn} = ctx do
+ with_mocks([
+ {File, [:passthrough], [stat: fn _ -> {:error, :eacces} end]}
+ ]) do
+ assert conn
+ |> put_req_header("content-type", "multipart/form-data")
+ |> patch(
+ "/api/pleroma/emoji/pack?name=test_pack",
+ %{"metadata" => ctx[:new_data]}
+ )
+ |> json_response_and_validate_schema(500)
+ end
+ end
+
test "for a pack without a fallback source", ctx do
assert ctx[:admin_conn]
|> put_req_header("content-type", "multipart/form-data")
@@ -424,6 +439,46 @@ test "when the fallback source doesn't have all the files", ctx do
end
describe "POST/DELETE /api/pleroma/emoji/pack?name=:name" do
+ test "returns an error on creates pack when file system not writable", %{
+ admin_conn: admin_conn
+ } do
+ path_pack = Path.join(@emoji_path, "test_pack")
+
+ with_mocks([
+ {File, [:passthrough], [mkdir: fn ^path_pack -> {:error, :eacces} end]}
+ ]) do
+ assert admin_conn
+ |> post("/api/pleroma/emoji/pack?name=test_pack")
+ |> json_response_and_validate_schema(500) == %{
+ "error" =>
+ "Unexpected error occurred while creating pack. (POSIX error: Permission denied)"
+ }
+ end
+ end
+
+ test "returns an error on deletes pack when the file system is not writable", %{
+ admin_conn: admin_conn
+ } do
+ path_pack = Path.join(@emoji_path, "test_emoji_pack")
+
+ try do
+ {:ok, _pack} = Pleroma.Emoji.Pack.create("test_emoji_pack")
+
+ with_mocks([
+ {File, [:passthrough], [rm_rf: fn ^path_pack -> {:error, :eacces, path_pack} end]}
+ ]) do
+ assert admin_conn
+ |> delete("/api/pleroma/emoji/pack?name=test_emoji_pack")
+ |> json_response_and_validate_schema(500) == %{
+ "error" =>
+ "Couldn't delete the `test_emoji_pack` pack (POSIX error: Permission denied)"
+ }
+ end
+ after
+ File.rm_rf(path_pack)
+ end
+ end
+
test "creating and deleting a pack", %{admin_conn: admin_conn} do
assert admin_conn
|> post("/api/pleroma/emoji/pack?name=test_created")
diff --git a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
index 3deab30d1..bda9c20c6 100644
--- a/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/emoji_reaction_controller_test.exs
@@ -106,6 +106,48 @@ test "GET /api/v1/pleroma/statuses/:id/reactions", %{conn: conn} do
result
end
+ test "GET /api/v1/pleroma/statuses/:id/reactions?with_muted=true", %{conn: conn} do
+ user = insert(:user)
+ user2 = insert(:user)
+ user3 = insert(:user)
+
+ token = insert(:oauth_token, user: user, scopes: ["read:statuses"])
+
+ {:ok, activity} = CommonAPI.post(user, %{status: "#cofe"})
+
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user2, "🎅")
+ {:ok, _} = CommonAPI.react_with_emoji(activity.id, user3, "🎅")
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> assign(:token, token)
+ |> get("/api/v1/pleroma/statuses/#{activity.id}/reactions")
+ |> json_response_and_validate_schema(200)
+
+ assert [%{"name" => "🎅", "count" => 2}] = result
+
+ User.mute(user, user3)
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> assign(:token, token)
+ |> get("/api/v1/pleroma/statuses/#{activity.id}/reactions")
+ |> json_response_and_validate_schema(200)
+
+ assert [%{"name" => "🎅", "count" => 1}] = result
+
+ result =
+ conn
+ |> assign(:user, user)
+ |> assign(:token, token)
+ |> get("/api/v1/pleroma/statuses/#{activity.id}/reactions?with_muted=true")
+ |> json_response_and_validate_schema(200)
+
+ assert [%{"name" => "🎅", "count" => 2}] = result
+ end
+
test "GET /api/v1/pleroma/statuses/:id/reactions with :show_reactions disabled", %{conn: conn} do
clear_config([:instance, :show_reactions], false)
diff --git a/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs
index 289119d45..5f8fa03f6 100644
--- a/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/mascot_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.MascotControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.User
diff --git a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs
index bb4fe6c49..03af4d70c 100644
--- a/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/notification_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.NotificationControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Notification
alias Pleroma.Repo
diff --git a/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs
index f39c07ac6..4ab6d9132 100644
--- a/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/scrobble_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ScrobbleControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Web.CommonAPI
diff --git a/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs
index 22988c881..8d4e0104a 100644
--- a/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/two_factor_authentication_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.TwoFactorAuthenticationControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
import Pleroma.Factory
alias Pleroma.MFA.Settings
diff --git a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs
index 68723de71..d83d33912 100644
--- a/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs
+++ b/test/pleroma/web/pleroma_api/controllers/user_import_controller_test.exs
@@ -47,7 +47,8 @@ test "it imports follow lists from file", %{conn: conn} do
|> json_response_and_validate_schema(200)
assert [{:ok, job_result}] = ObanHelpers.perform_all()
- assert job_result == [user2]
+ assert job_result == [refresh_record(user2)]
+ assert [%Pleroma.User{follower_count: 1}] = job_result
end
end
@@ -108,7 +109,7 @@ test "it imports follows with different nickname variations", %{conn: conn} do
|> json_response_and_validate_schema(200)
assert [{:ok, job_result}] = ObanHelpers.perform_all()
- assert job_result == users
+ assert job_result == Enum.map(users, &refresh_record/1)
end
end
diff --git a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs
index ae8257870..93eef00a2 100644
--- a/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs
+++ b/test/pleroma/web/pleroma_api/views/chat_message_reference_view_test.exs
@@ -48,7 +48,7 @@ test "it displays a chat message" do
clear_config([:rich_media, :enabled], true)
- Tesla.Mock.mock(fn
+ Tesla.Mock.mock_global(fn
%{url: "https://example.com/ogp"} ->
%Tesla.Env{status: 200, body: File.read!("test/fixtures/rich_media/ogp.html")}
end)
diff --git a/test/pleroma/web/pleroma_api/views/chat_view_test.exs b/test/pleroma/web/pleroma_api/views/chat_view_test.exs
index 02484b705..b60b597e8 100644
--- a/test/pleroma/web/pleroma_api/views/chat_view_test.exs
+++ b/test/pleroma/web/pleroma_api/views/chat_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ChatViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Chat
alias Pleroma.Chat.MessageReference
diff --git a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs
index 0f43cbdc3..113b8f690 100644
--- a/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs
+++ b/test/pleroma/web/pleroma_api/views/scrobble_view_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.PleromaAPI.ScrobbleViewTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.PleromaAPI.ScrobbleView
diff --git a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
index 33394722a..23498badf 100644
--- a/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/admin_secret_authentication_plug_test.exs
@@ -49,6 +49,7 @@ test "with `admin_token` query parameter", %{conn: conn} do
|> AdminSecretAuthenticationPlug.call(%{})
assert conn.assigns[:user].is_admin
+ assert conn.assigns[:token] == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
end
@@ -69,6 +70,7 @@ test "with `x-admin-token` HTTP header", %{conn: conn} do
|> AdminSecretAuthenticationPlug.call(%{})
assert conn.assigns[:user].is_admin
+ assert conn.assigns[:token] == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
end
end
diff --git a/test/pleroma/web/plugs/authentication_plug_test.exs b/test/pleroma/web/plugs/authentication_plug_test.exs
index af39352e2..3dedd38b2 100644
--- a/test/pleroma/web/plugs/authentication_plug_test.exs
+++ b/test/pleroma/web/plugs/authentication_plug_test.exs
@@ -48,6 +48,7 @@ test "with a correct password in the credentials, " <>
|> AuthenticationPlug.call(%{})
assert conn.assigns.user == conn.assigns.auth_user
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
end
@@ -62,6 +63,7 @@ test "with a bcrypt hash, it updates to a pkbdf2 hash", %{conn: conn} do
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
@@ -83,6 +85,7 @@ test "with a crypt hash, it updates to a pkbdf2 hash", %{conn: conn} do
|> AuthenticationPlug.call(%{})
assert conn.assigns.user.id == conn.assigns.auth_user.id
+ assert conn.assigns.token == nil
assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
user = User.get_by_id(user.id)
diff --git a/test/pleroma/web/plugs/cache_control_test.exs b/test/pleroma/web/plugs/cache_control_test.exs
index fcf3d2be8..c775787ca 100644
--- a/test/pleroma/web/plugs/cache_control_test.exs
+++ b/test/pleroma/web/plugs/cache_control_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.CacheControlTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Plug.Conn
test "Verify Cache-Control header on static assets", %{conn: conn} do
diff --git a/test/pleroma/web/plugs/cache_test.exs b/test/pleroma/web/plugs/cache_test.exs
index 93a66f5d3..0e5fa6f36 100644
--- a/test/pleroma/web/plugs/cache_test.exs
+++ b/test/pleroma/web/plugs/cache_test.exs
@@ -3,7 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.CacheTest do
- use ExUnit.Case, async: true
+ # Relies on Cachex, has to stay synchronous
+ use Pleroma.DataCase
use Plug.Test
alias Pleroma.Web.Plugs.Cache
@@ -24,11 +25,6 @@ defmodule Pleroma.Web.Plugs.CacheTest do
@ttl 5
- setup do
- Cachex.clear(:web_resp_cache)
- :ok
- end
-
test "caches a response" do
assert @miss_resp ==
conn(:get, "/")
diff --git a/test/pleroma/web/plugs/digest_plug_test.exs b/test/pleroma/web/plugs/digest_plug_test.exs
new file mode 100644
index 000000000..629c28c93
--- /dev/null
+++ b/test/pleroma/web/plugs/digest_plug_test.exs
@@ -0,0 +1,48 @@
+defmodule Pleroma.Web.Plugs.DigestPlugTest do
+ use ExUnit.Case, async: true
+ use Plug.Test
+
+ test "digest algorithm is taken from digest header" do
+ body = "{\"hello\": \"world\"}"
+ digest = "X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE="
+
+ {:ok, ^body, conn} =
+ :get
+ |> conn("/", body)
+ |> put_req_header("content-type", "application/json")
+ |> put_req_header("digest", "sha-256=" <> digest)
+ |> Pleroma.Web.Plugs.DigestPlug.read_body([])
+
+ assert conn.assigns[:digest] == "sha-256=" <> digest
+
+ {:ok, ^body, conn} =
+ :get
+ |> conn("/", body)
+ |> put_req_header("content-type", "application/json")
+ |> put_req_header("digest", "SHA-256=" <> digest)
+ |> Pleroma.Web.Plugs.DigestPlug.read_body([])
+
+ assert conn.assigns[:digest] == "SHA-256=" <> digest
+ end
+
+ test "error if digest algorithm is invalid" do
+ body = "{\"hello\": \"world\"}"
+ digest = "X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE="
+
+ assert_raise ArgumentError, "invalid value for digest algorithm, got: MD5", fn ->
+ :get
+ |> conn("/", body)
+ |> put_req_header("content-type", "application/json")
+ |> put_req_header("digest", "MD5=" <> digest)
+ |> Pleroma.Web.Plugs.DigestPlug.read_body([])
+ end
+
+ assert_raise ArgumentError, "invalid value for digest algorithm, got: md5", fn ->
+ :get
+ |> conn("/", body)
+ |> put_req_header("content-type", "application/json")
+ |> put_req_header("digest", "md5=" <> digest)
+ |> Pleroma.Web.Plugs.DigestPlug.read_body([])
+ end
+ end
+end
diff --git a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs
index 211443a55..9f15f5c93 100644
--- a/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs
+++ b/test/pleroma/web/plugs/ensure_public_or_authenticated_plug_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.EnsurePublicOrAuthenticatedPlugTest do
- use Pleroma.Web.ConnCase, async: true
+ use Pleroma.Web.ConnCase
alias Pleroma.Config
alias Pleroma.User
diff --git a/test/pleroma/web/plugs/ensure_user_key_plug_test.exs b/test/pleroma/web/plugs/ensure_user_key_plug_test.exs
deleted file mode 100644
index f912ef755..000000000
--- a/test/pleroma/web/plugs/ensure_user_key_plug_test.exs
+++ /dev/null
@@ -1,29 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.Plugs.EnsureUserKeyPlugTest do
- use Pleroma.Web.ConnCase, async: true
-
- alias Pleroma.Web.Plugs.EnsureUserKeyPlug
-
- test "if the conn has a user key set, it does nothing", %{conn: conn} do
- conn =
- conn
- |> assign(:user, 1)
-
- ret_conn =
- conn
- |> EnsureUserKeyPlug.call(%{})
-
- assert conn == ret_conn
- end
-
- test "if the conn has no key set, it sets it to nil", %{conn: conn} do
- conn =
- conn
- |> EnsureUserKeyPlug.call(%{})
-
- assert Map.has_key?(conn.assigns, :user)
- end
-end
diff --git a/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs b/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs
new file mode 100644
index 000000000..9592820c7
--- /dev/null
+++ b/test/pleroma/web/plugs/ensure_user_token_assigns_plug_test.exs
@@ -0,0 +1,69 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Web.Plugs.EnsureUserTokenAssignsPlugTest do
+ use Pleroma.Web.ConnCase, async: true
+
+ import Pleroma.Factory
+
+ alias Pleroma.Web.Plugs.EnsureUserTokenAssignsPlug
+
+ test "with :user assign set to a User record " <>
+ "and :token assign set to a Token belonging to this user, " <>
+ "it does nothing" do
+ %{conn: conn} = oauth_access(["read"])
+
+ ret_conn = EnsureUserTokenAssignsPlug.call(conn, %{})
+
+ assert conn == ret_conn
+ end
+
+ test "with :user assign set to a User record " <>
+ "but :token assign not set or not a Token, " <>
+ "it assigns :token to `nil`",
+ %{conn: conn} do
+ user = insert(:user)
+ conn = assign(conn, :user, user)
+
+ ret_conn = EnsureUserTokenAssignsPlug.call(conn, %{})
+
+ assert %{token: nil} = ret_conn.assigns
+
+ ret_conn2 =
+ conn
+ |> assign(:token, 1)
+ |> EnsureUserTokenAssignsPlug.call(%{})
+
+ assert %{token: nil} = ret_conn2.assigns
+ end
+
+ # Abnormal (unexpected) scenario
+ test "with :user assign set to a User record " <>
+ "but :token assign set to a Token NOT belonging to :user, " <>
+ "it drops auth info" do
+ %{conn: conn} = oauth_access(["read"])
+ other_user = insert(:user)
+
+ conn = assign(conn, :user, other_user)
+
+ ret_conn = EnsureUserTokenAssignsPlug.call(conn, %{})
+
+ assert %{user: nil, token: nil} = ret_conn.assigns
+ end
+
+ test "if :user assign is not set to a User record, it sets :user and :token to nil", %{
+ conn: conn
+ } do
+ ret_conn = EnsureUserTokenAssignsPlug.call(conn, %{})
+
+ assert %{user: nil, token: nil} = ret_conn.assigns
+
+ ret_conn2 =
+ conn
+ |> assign(:user, 1)
+ |> EnsureUserTokenAssignsPlug.call(%{})
+
+ assert %{user: nil, token: nil} = ret_conn2.assigns
+ end
+end
diff --git a/test/pleroma/web/plugs/idempotency_plug_test.exs b/test/pleroma/web/plugs/idempotency_plug_test.exs
index 4a7835993..ed8b3fc1a 100644
--- a/test/pleroma/web/plugs/idempotency_plug_test.exs
+++ b/test/pleroma/web/plugs/idempotency_plug_test.exs
@@ -3,7 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.IdempotencyPlugTest do
- use ExUnit.Case, async: true
+ # Relies on Cachex, has to stay synchronous
+ use Pleroma.DataCase
use Plug.Test
alias Pleroma.Web.Plugs.IdempotencyPlug
diff --git a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs b/test/pleroma/web/plugs/legacy_authentication_plug_test.exs
deleted file mode 100644
index 2016a31a8..000000000
--- a/test/pleroma/web/plugs/legacy_authentication_plug_test.exs
+++ /dev/null
@@ -1,82 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.Plugs.LegacyAuthenticationPlugTest do
- use Pleroma.Web.ConnCase
-
- import Pleroma.Factory
-
- alias Pleroma.User
- alias Pleroma.Web.Plugs.LegacyAuthenticationPlug
- alias Pleroma.Web.Plugs.OAuthScopesPlug
- alias Pleroma.Web.Plugs.PlugHelper
-
- setup do
- user =
- insert(:user,
- password: "password",
- password_hash:
- "$6$9psBWV8gxkGOZWBz$PmfCycChoxeJ3GgGzwvhlgacb9mUoZ.KUXNCssekER4SJ7bOK53uXrHNb2e4i8yPFgSKyzaW9CcmrDXWIEMtD1"
- )
-
- %{user: user}
- end
-
- test "it does nothing if a user is assigned", %{conn: conn, user: user} do
- conn =
- conn
- |> assign(:auth_credentials, %{username: "dude", password: "password"})
- |> assign(:auth_user, user)
- |> assign(:user, %User{})
-
- ret_conn =
- conn
- |> LegacyAuthenticationPlug.call(%{})
-
- assert ret_conn == conn
- end
-
- @tag :skip_on_mac
- test "if `auth_user` is present and password is correct, " <>
- "it authenticates the user, resets the password, marks OAuthScopesPlug as skipped",
- %{
- conn: conn,
- user: user
- } do
- conn =
- conn
- |> assign(:auth_credentials, %{username: "dude", password: "password"})
- |> assign(:auth_user, user)
-
- conn = LegacyAuthenticationPlug.call(conn, %{})
-
- assert conn.assigns.user.id == user.id
- assert PlugHelper.plug_skipped?(conn, OAuthScopesPlug)
- end
-
- @tag :skip_on_mac
- test "it does nothing if the password is wrong", %{
- conn: conn,
- user: user
- } do
- conn =
- conn
- |> assign(:auth_credentials, %{username: "dude", password: "wrong_password"})
- |> assign(:auth_user, user)
-
- ret_conn =
- conn
- |> LegacyAuthenticationPlug.call(%{})
-
- assert conn == ret_conn
- end
-
- test "with no credentials or user it does nothing", %{conn: conn} do
- ret_conn =
- conn
- |> LegacyAuthenticationPlug.call(%{})
-
- assert ret_conn == conn
- end
-end
diff --git a/test/pleroma/web/plugs/o_auth_plug_test.exs b/test/pleroma/web/plugs/o_auth_plug_test.exs
index b9d722f76..1186cdb14 100644
--- a/test/pleroma/web/plugs/o_auth_plug_test.exs
+++ b/test/pleroma/web/plugs/o_auth_plug_test.exs
@@ -5,43 +5,49 @@
defmodule Pleroma.Web.Plugs.OAuthPlugTest do
use Pleroma.Web.ConnCase, async: true
+ alias Pleroma.Helpers.AuthHelper
+ alias Pleroma.Web.OAuth.Token
+ alias Pleroma.Web.OAuth.Token.Strategy.Revoke
alias Pleroma.Web.Plugs.OAuthPlug
- import Pleroma.Factory
+ alias Plug.Session
- @session_opts [
- store: :cookie,
- key: "_test",
- signing_salt: "cooldude"
- ]
+ import Pleroma.Factory
setup %{conn: conn} do
user = insert(:user)
- {:ok, %{token: token}} = Pleroma.Web.OAuth.Token.create(insert(:oauth_app), user)
- %{user: user, token: token, conn: conn}
+ {:ok, oauth_token} = Token.create(insert(:oauth_app), user)
+ %{user: user, token: oauth_token, conn: conn}
end
- test "with valid token(uppercase), it assigns the user", %{conn: conn} = opts do
+ test "it does nothing if a user is assigned", %{conn: conn} do
+ conn = assign(conn, :user, %Pleroma.User{})
+ ret_conn = OAuthPlug.call(conn, %{})
+
+ assert ret_conn == conn
+ end
+
+ test "with valid token (uppercase) in auth header, it assigns the user", %{conn: conn} = opts do
conn =
conn
- |> put_req_header("authorization", "BEARER #{opts[:token]}")
+ |> put_req_header("authorization", "BEARER #{opts[:token].token}")
|> OAuthPlug.call(%{})
assert conn.assigns[:user] == opts[:user]
end
- test "with valid token(downcase), it assigns the user", %{conn: conn} = opts do
+ test "with valid token (downcase) in auth header, it assigns the user", %{conn: conn} = opts do
conn =
conn
- |> put_req_header("authorization", "bearer #{opts[:token]}")
+ |> put_req_header("authorization", "bearer #{opts[:token].token}")
|> OAuthPlug.call(%{})
assert conn.assigns[:user] == opts[:user]
end
- test "with valid token(downcase) in url parameters, it assigns the user", opts do
+ test "with valid token (downcase) in url parameters, it assigns the user", opts do
conn =
:get
- |> build_conn("/?access_token=#{opts[:token]}")
+ |> build_conn("/?access_token=#{opts[:token].token}")
|> put_req_header("content-type", "application/json")
|> fetch_query_params()
|> OAuthPlug.call(%{})
@@ -49,16 +55,16 @@ test "with valid token(downcase) in url parameters, it assigns the user", opts d
assert conn.assigns[:user] == opts[:user]
end
- test "with valid token(downcase) in body parameters, it assigns the user", opts do
+ test "with valid token (downcase) in body parameters, it assigns the user", opts do
conn =
:post
- |> build_conn("/api/v1/statuses", access_token: opts[:token], status: "test")
+ |> build_conn("/api/v1/statuses", access_token: opts[:token].token, status: "test")
|> OAuthPlug.call(%{})
assert conn.assigns[:user] == opts[:user]
end
- test "with invalid token, it not assigns the user", %{conn: conn} do
+ test "with invalid token, it does not assign the user", %{conn: conn} do
conn =
conn
|> put_req_header("authorization", "bearer TTTTT")
@@ -67,14 +73,56 @@ test "with invalid token, it not assigns the user", %{conn: conn} do
refute conn.assigns[:user]
end
- test "when token is missed but token in session, it assigns the user", %{conn: conn} = opts do
- conn =
- conn
- |> Plug.Session.call(Plug.Session.init(@session_opts))
- |> fetch_session()
- |> put_session(:oauth_token, opts[:token])
- |> OAuthPlug.call(%{})
+ describe "with :oauth_token in session, " do
+ setup %{token: oauth_token, conn: conn} do
+ session_opts = [
+ store: :cookie,
+ key: "_test",
+ signing_salt: "cooldude"
+ ]
- assert conn.assigns[:user] == opts[:user]
+ conn =
+ conn
+ |> Session.call(Session.init(session_opts))
+ |> fetch_session()
+ |> AuthHelper.put_session_token(oauth_token.token)
+
+ %{conn: conn}
+ end
+
+ test "if session-stored token matches a valid OAuth token, assigns :user and :token", %{
+ conn: conn,
+ user: user,
+ token: oauth_token
+ } do
+ conn = OAuthPlug.call(conn, %{})
+
+ assert conn.assigns.user && conn.assigns.user.id == user.id
+ assert conn.assigns.token && conn.assigns.token.id == oauth_token.id
+ end
+
+ test "if session-stored token matches an expired OAuth token, does nothing", %{
+ conn: conn,
+ token: oauth_token
+ } do
+ expired_valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), -3600 * 24, :second)
+
+ oauth_token
+ |> Ecto.Changeset.change(valid_until: expired_valid_until)
+ |> Pleroma.Repo.update()
+
+ ret_conn = OAuthPlug.call(conn, %{})
+ assert ret_conn == conn
+ end
+
+ test "if session-stored token matches a revoked OAuth token, does nothing", %{
+ conn: conn,
+ token: oauth_token
+ } do
+ Revoke.revoke(oauth_token)
+
+ ret_conn = OAuthPlug.call(conn, %{})
+ assert ret_conn == conn
+ end
end
end
diff --git a/test/pleroma/web/plugs/session_authentication_plug_test.exs b/test/pleroma/web/plugs/session_authentication_plug_test.exs
deleted file mode 100644
index 2b4d5bc0c..000000000
--- a/test/pleroma/web/plugs/session_authentication_plug_test.exs
+++ /dev/null
@@ -1,63 +0,0 @@
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
-# SPDX-License-Identifier: AGPL-3.0-only
-
-defmodule Pleroma.Web.Plugs.SessionAuthenticationPlugTest do
- use Pleroma.Web.ConnCase, async: true
-
- alias Pleroma.User
- alias Pleroma.Web.Plugs.SessionAuthenticationPlug
-
- setup %{conn: conn} do
- session_opts = [
- store: :cookie,
- key: "_test",
- signing_salt: "cooldude"
- ]
-
- conn =
- conn
- |> Plug.Session.call(Plug.Session.init(session_opts))
- |> fetch_session
- |> assign(:auth_user, %User{id: 1})
-
- %{conn: conn}
- end
-
- test "it does nothing if a user is assigned", %{conn: conn} do
- conn =
- conn
- |> assign(:user, %User{})
-
- ret_conn =
- conn
- |> SessionAuthenticationPlug.call(%{})
-
- assert ret_conn == conn
- end
-
- test "if the auth_user has the same id as the user_id in the session, it assigns the user", %{
- conn: conn
- } do
- conn =
- conn
- |> put_session(:user_id, conn.assigns.auth_user.id)
- |> SessionAuthenticationPlug.call(%{})
-
- assert conn.assigns.user == conn.assigns.auth_user
- end
-
- test "if the auth_user has a different id as the user_id in the session, it does nothing", %{
- conn: conn
- } do
- conn =
- conn
- |> put_session(:user_id, -1)
-
- ret_conn =
- conn
- |> SessionAuthenticationPlug.call(%{})
-
- assert ret_conn == conn
- end
-end
diff --git a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs
index a89b5628f..21417d0e7 100644
--- a/test/pleroma/web/plugs/set_user_session_id_plug_test.exs
+++ b/test/pleroma/web/plugs/set_user_session_id_plug_test.exs
@@ -5,7 +5,7 @@
defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do
use Pleroma.Web.ConnCase, async: true
- alias Pleroma.User
+ alias Pleroma.Helpers.AuthHelper
alias Pleroma.Web.Plugs.SetUserSessionIdPlug
setup %{conn: conn} do
@@ -18,28 +18,26 @@ defmodule Pleroma.Web.Plugs.SetUserSessionIdPlugTest do
conn =
conn
|> Plug.Session.call(Plug.Session.init(session_opts))
- |> fetch_session
+ |> fetch_session()
%{conn: conn}
end
test "doesn't do anything if the user isn't set", %{conn: conn} do
- ret_conn =
- conn
- |> SetUserSessionIdPlug.call(%{})
+ ret_conn = SetUserSessionIdPlug.call(conn, %{})
assert ret_conn == conn
end
- test "sets the user_id in the session to the user id of the user assign", %{conn: conn} do
- Code.ensure_compiled(Pleroma.User)
+ test "sets session token basing on :token assign", %{conn: conn} do
+ %{user: user, token: oauth_token} = oauth_access(["read"])
- conn =
+ ret_conn =
conn
- |> assign(:user, %User{id: 1})
+ |> assign(:user, user)
+ |> assign(:token, oauth_token)
|> SetUserSessionIdPlug.call(%{})
- id = get_session(conn, :user_id)
- assert id == 1
+ assert AuthHelper.get_session_token(ret_conn) == oauth_token.token
end
end
diff --git a/test/pleroma/web/plugs/uploaded_media_plug_test.exs b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
index 7c8313121..bae9208ec 100644
--- a/test/pleroma/web/plugs/uploaded_media_plug_test.exs
+++ b/test/pleroma/web/plugs/uploaded_media_plug_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.UploadedMediaPlugTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Upload
defp upload_file(context) do
diff --git a/test/pleroma/web/plugs/user_enabled_plug_test.exs b/test/pleroma/web/plugs/user_enabled_plug_test.exs
index 71c56f03a..e9c9e5f3e 100644
--- a/test/pleroma/web/plugs/user_enabled_plug_test.exs
+++ b/test/pleroma/web/plugs/user_enabled_plug_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.UserEnabledPlugTest do
- use Pleroma.Web.ConnCase, async: true
+ use Pleroma.Web.ConnCase
alias Pleroma.Web.Plugs.UserEnabledPlug
import Pleroma.Factory
diff --git a/test/pleroma/web/preload/providers/instance_test.exs b/test/pleroma/web/preload/providers/instance_test.exs
index 8493f2a94..6033899b0 100644
--- a/test/pleroma/web/preload/providers/instance_test.exs
+++ b/test/pleroma/web/preload/providers/instance_test.exs
@@ -50,7 +50,7 @@ test "it renders the frontend configurations", %{
"/api/pleroma/frontend_configurations" => fe_configs
} do
assert %{
- pleroma_fe: %{background: "/images/city.jpg", logo: "/static/logo.png"}
+ pleroma_fe: %{background: "/images/city.jpg", logo: "/static/logo.svg"}
} = fe_configs
end
end
diff --git a/test/pleroma/web/preload/providers/user_test.exs b/test/pleroma/web/preload/providers/user_test.exs
index 83f065e27..6be03af79 100644
--- a/test/pleroma/web/preload/providers/user_test.exs
+++ b/test/pleroma/web/preload/providers/user_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Preload.Providers.UserTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Web.Preload.Providers.User
diff --git a/test/pleroma/web/push/impl_test.exs b/test/pleroma/web/push/impl_test.exs
index 7d8cc999a..326a67963 100644
--- a/test/pleroma/web/push/impl_test.exs
+++ b/test/pleroma/web/push/impl_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Push.ImplTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
@@ -184,6 +184,24 @@ test "renders title and body for like activity" do
"New Favorite"
end
+ test "renders title and body for pleroma:emoji_reaction activity" do
+ user = insert(:user, nickname: "Bob")
+
+ {:ok, activity} =
+ CommonAPI.post(user, %{
+ status: "This post is a really good post!"
+ })
+
+ {:ok, activity} = CommonAPI.react_with_emoji(activity.id, user, "👍")
+ object = Object.normalize(activity)
+
+ assert Impl.format_body(%{activity: activity, type: "pleroma:emoji_reaction"}, user, object) ==
+ "@Bob reacted with 👍"
+
+ assert Impl.format_title(%{activity: activity, type: "pleroma:emoji_reaction"}) ==
+ "New Reaction"
+ end
+
test "renders title for create activity with direct visibility" do
user = insert(:user, nickname: "Bob")
diff --git a/test/pleroma/web/rel_me_test.exs b/test/pleroma/web/rel_me_test.exs
index 65255916d..811cb0893 100644
--- a/test/pleroma/web/rel_me_test.exs
+++ b/test/pleroma/web/rel_me_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RelMeTest do
- use ExUnit.Case
+ use Pleroma.DataCase
setup_all do
Tesla.Mock.mock_global(fn env -> apply(HttpRequestMock, :request, [env]) end)
diff --git a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs
index 2f17bebd7..242521138 100644
--- a/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs
+++ b/test/pleroma/web/rich_media/parser/ttl/aws_signed_url_test.exs
@@ -3,7 +3,8 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrlTest do
- use ExUnit.Case, async: true
+ # Relies on Cachex, needs to be synchronous
+ use Pleroma.DataCase
test "s3 signed url is parsed correct for expiration time" do
url = "https://pleroma.social/amz"
diff --git a/test/pleroma/web/streamer_test.exs b/test/pleroma/web/streamer_test.exs
index 0d89e01d0..ad66ddc9d 100644
--- a/test/pleroma/web/streamer_test.exs
+++ b/test/pleroma/web/streamer_test.exs
@@ -222,7 +222,7 @@ test "it streams boosts of mastodon user in the 'user' stream", %{
data =
File.read!("test/fixtures/mastodon-announce.json")
- |> Poison.decode!()
+ |> Jason.decode!()
|> Map.put("object", activity.data["object"])
|> Map.put("actor", user.ap_id)
@@ -403,6 +403,67 @@ test "it sends follow activities to the 'user:notification' stream", %{
assert notif.activity.id == follow_activity.id
refute Streamer.filtered_by_user?(user, notif)
end
+
+ test "it sends follow relationships updates to the 'user' stream", %{
+ user: user,
+ token: oauth_token
+ } do
+ user_id = user.id
+ user_url = user.ap_id
+ other_user = insert(:user)
+ other_user_id = other_user.id
+
+ body =
+ File.read!("test/fixtures/users_mock/localhost.json")
+ |> String.replace("{{nickname}}", user.nickname)
+ |> Jason.encode!()
+
+ Tesla.Mock.mock_global(fn
+ %{method: :get, url: ^user_url} ->
+ %Tesla.Env{status: 200, body: body}
+ end)
+
+ Streamer.get_topic_and_add_socket("user", user, oauth_token)
+ {:ok, _follower, _followed, _follow_activity} = CommonAPI.follow(user, other_user)
+
+ assert_receive {:text, event}
+
+ assert %{"event" => "pleroma:follow_relationships_update", "payload" => payload} =
+ Jason.decode!(event)
+
+ assert %{
+ "follower" => %{
+ "follower_count" => 0,
+ "following_count" => 0,
+ "id" => ^user_id
+ },
+ "following" => %{
+ "follower_count" => 0,
+ "following_count" => 0,
+ "id" => ^other_user_id
+ },
+ "state" => "follow_pending"
+ } = Jason.decode!(payload)
+
+ assert_receive {:text, event}
+
+ assert %{"event" => "pleroma:follow_relationships_update", "payload" => payload} =
+ Jason.decode!(event)
+
+ assert %{
+ "follower" => %{
+ "follower_count" => 0,
+ "following_count" => 1,
+ "id" => ^user_id
+ },
+ "following" => %{
+ "follower_count" => 1,
+ "following_count" => 0,
+ "id" => ^other_user_id
+ },
+ "state" => "follow_accept"
+ } = Jason.decode!(payload)
+ end
end
describe "public streams" do
@@ -563,7 +624,7 @@ test "it doesn't send unwanted DMs to list", %{user: user_a, token: user_a_token
user_b = insert(:user)
user_c = insert(:user)
- {:ok, user_a} = User.follow(user_a, user_b)
+ {:ok, user_a, user_b} = User.follow(user_a, user_b)
{:ok, list} = List.create("Test", user_a)
{:ok, list} = List.follow(list, user_b)
@@ -599,7 +660,7 @@ test "it doesn't send unwanted private posts to list", %{user: user_a, token: us
test "it sends wanted private posts to list", %{user: user_a, token: user_a_token} do
user_b = insert(:user)
- {:ok, user_a} = User.follow(user_a, user_b)
+ {:ok, user_a, user_b} = User.follow(user_a, user_b)
{:ok, list} = List.create("Test", user_a)
{:ok, list} = List.follow(list, user_b)
diff --git a/test/pleroma/web/twitter_api/controller_test.exs b/test/pleroma/web/twitter_api/controller_test.exs
index 464d0ea2e..b3ca67637 100644
--- a/test/pleroma/web/twitter_api/controller_test.exs
+++ b/test/pleroma/web/twitter_api/controller_test.exs
@@ -3,11 +3,11 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.TwitterAPI.ControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
- alias Pleroma.Builders.ActivityBuilder
alias Pleroma.Repo
alias Pleroma.User
+ alias Pleroma.Web.CommonAPI
alias Pleroma.Web.OAuth.Token
import Pleroma.Factory
@@ -36,22 +36,20 @@ test "with credentials, with params" do
other_user = insert(:user)
{:ok, _activity} =
- ActivityBuilder.insert(%{"to" => [current_user.ap_id]}, %{user: other_user})
+ CommonAPI.post(other_user, %{
+ status: "Hey @#{current_user.nickname}"
+ })
response_conn =
conn
- |> assign(:user, current_user)
|> get("/api/v1/notifications")
- [notification] = response = json_response(response_conn, 200)
-
- assert length(response) == 1
+ [notification] = json_response(response_conn, 200)
assert notification["pleroma"]["is_seen"] == false
response_conn =
conn
- |> assign(:user, current_user)
|> post("/api/qvitter/statuses/notifications/read", %{"latest_id" => notification["id"]})
[notification] = response = json_response(response_conn, 200)
diff --git a/test/pleroma/web/twitter_api/password_controller_test.exs b/test/pleroma/web/twitter_api/password_controller_test.exs
index a5e9e2178..c1f5bc5c7 100644
--- a/test/pleroma/web/twitter_api/password_controller_test.exs
+++ b/test/pleroma/web/twitter_api/password_controller_test.exs
@@ -31,9 +31,47 @@ test "it shows password reset form", %{conn: conn} do
assert response =~ "Password Reset for #{user.nickname} "
end
+
+ test "it returns an error when the token has expired", %{conn: conn} do
+ clear_config([:instance, :password_reset_token_validity], 0)
+
+ user = insert(:user)
+ {:ok, token} = PasswordResetToken.create_token(user)
+ {:ok, token} = time_travel(token, -2)
+
+ response =
+ conn
+ |> get("/api/pleroma/password_reset/#{token.token}")
+ |> html_response(:ok)
+
+ assert response =~ "Invalid Token "
+ end
end
describe "POST /api/pleroma/password_reset" do
+ test "it fails for an expired token", %{conn: conn} do
+ clear_config([:instance, :password_reset_token_validity], 0)
+
+ user = insert(:user)
+ {:ok, token} = PasswordResetToken.create_token(user)
+ {:ok, token} = time_travel(token, -2)
+ {:ok, _access_token} = Token.create(insert(:oauth_app), user, %{})
+
+ params = %{
+ "password" => "test",
+ password_confirmation: "test",
+ token: token.token
+ }
+
+ response =
+ conn
+ |> assign(:user, user)
+ |> post("/api/pleroma/password_reset", %{data: params})
+ |> html_response(:ok)
+
+ refute response =~ "Password changed! "
+ end
+
test "it returns HTTP 200", %{conn: conn} do
user = insert(:user)
{:ok, token} = PasswordResetToken.create_token(user)
diff --git a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
index a3e784d13..dfe5b02be 100644
--- a/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
+++ b/test/pleroma/web/twitter_api/remote_follow_controller_test.exs
@@ -14,18 +14,27 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
import Pleroma.Factory
import Ecto.Query
- setup do
- Tesla.Mock.mock(fn env -> apply(HttpRequestMock, :request, [env]) end)
- :ok
- end
-
setup_all do: clear_config([:instance, :federating], true)
- setup do: clear_config([:instance])
- setup do: clear_config([:frontend_configurations, :pleroma_fe])
setup do: clear_config([:user, :deny_follow_blocked])
describe "GET /ostatus_subscribe - remote_follow/2" do
test "adds status to pleroma instance if the `acct` is a status", %{conn: conn} do
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://mastodon.social/users/emelie/statuses/101849165031453009"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body: File.read!("test/fixtures/tesla_mock/status.emelie.json")
+ }
+
+ %{method: :get, url: "https://mastodon.social/users/emelie"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body: File.read!("test/fixtures/tesla_mock/emelie.json")
+ }
+ end)
+
assert conn
|> get(
remote_follow_path(conn, :follow, %{
@@ -36,6 +45,15 @@ test "adds status to pleroma instance if the `acct` is a status", %{conn: conn}
end
test "show follow account page if the `acct` is a account link", %{conn: conn} do
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://mastodon.social/users/emelie"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body: File.read!("test/fixtures/tesla_mock/emelie.json")
+ }
+ end)
+
response =
conn
|> get(remote_follow_path(conn, :follow, %{acct: "https://mastodon.social/users/emelie"}))
@@ -45,6 +63,15 @@ test "show follow account page if the `acct` is a account link", %{conn: conn} d
end
test "show follow page if the `acct` is a account link", %{conn: conn} do
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://mastodon.social/users/emelie"} ->
+ %Tesla.Env{
+ status: 200,
+ headers: [{"content-type", "application/activity+json"}],
+ body: File.read!("test/fixtures/tesla_mock/emelie.json")
+ }
+ end)
+
user = insert(:user)
response =
@@ -56,7 +83,14 @@ test "show follow page if the `acct` is a account link", %{conn: conn} do
assert response =~ "Remote follow"
end
- test "show follow page with error when user cannot fecth by `acct` link", %{conn: conn} do
+ test "show follow page with error when user can not be fetched by `acct` link", %{conn: conn} do
+ Tesla.Mock.mock(fn
+ %{method: :get, url: "https://mastodon.social/users/not_found"} ->
+ %Tesla.Env{
+ status: 404
+ }
+ end)
+
user = insert(:user)
assert capture_log(fn ->
diff --git a/test/pleroma/web/twitter_api/twitter_api_test.exs b/test/pleroma/web/twitter_api/twitter_api_test.exs
index 20a45cb6f..5586a9a13 100644
--- a/test/pleroma/web/twitter_api/twitter_api_test.exs
+++ b/test/pleroma/web/twitter_api/twitter_api_test.exs
@@ -80,13 +80,9 @@ test "it sends confirmation email if :account_activation_required is specified i
end
test "it sends an admin email if :account_approval_required is specified in instance config" do
- admin = insert(:user, is_admin: true)
- setting = Pleroma.Config.get([:instance, :account_approval_required])
+ clear_config([:instance, :account_approval_required], true)
- unless setting do
- Pleroma.Config.put([:instance, :account_approval_required], true)
- on_exit(fn -> Pleroma.Config.put([:instance, :account_approval_required], setting) end)
- end
+ admin = insert(:user, is_admin: true)
data = %{
:username => "lain",
@@ -103,15 +99,24 @@ test "it sends an admin email if :account_approval_required is specified in inst
assert user.approval_pending
- email = Pleroma.Emails.AdminEmail.new_unapproved_registration(admin, user)
+ user_email = Pleroma.Emails.UserEmail.approval_pending_email(user)
+ admin_email = Pleroma.Emails.AdminEmail.new_unapproved_registration(admin, user)
notify_email = Pleroma.Config.get([:instance, :notify_email])
instance_name = Pleroma.Config.get([:instance, :name])
+ # User approval email
+ Swoosh.TestAssertions.assert_email_sent(
+ from: {instance_name, notify_email},
+ to: {user.name, user.email},
+ html_body: user_email.html_body
+ )
+
+ # Admin email
Swoosh.TestAssertions.assert_email_sent(
from: {instance_name, notify_email},
to: {admin.name, admin.email},
- html_body: email.html_body
+ html_body: admin_email.html_body
)
end
@@ -423,10 +428,4 @@ test "it returns the error on registration problems" do
assert is_binary(error)
refute User.get_cached_by_nickname("lain")
end
-
- setup do
- Supervisor.terminate_child(Pleroma.Supervisor, Cachex)
- Supervisor.restart_child(Pleroma.Supervisor, Cachex)
- :ok
- end
end
diff --git a/test/pleroma/web/uploader_controller_test.exs b/test/pleroma/web/uploader_controller_test.exs
index 21e518236..00f9e72ec 100644
--- a/test/pleroma/web/uploader_controller_test.exs
+++ b/test/pleroma/web/uploader_controller_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.UploaderControllerTest do
- use Pleroma.Web.ConnCase
+ use Pleroma.Web.ConnCase, async: true
alias Pleroma.Uploaders.Uploader
describe "callback/2" do
diff --git a/test/pleroma/web/web_finger/web_finger_controller_test.exs b/test/pleroma/web/web_finger/web_finger_controller_test.exs
index 0023f1e81..ce9eb0650 100644
--- a/test/pleroma/web/web_finger/web_finger_controller_test.exs
+++ b/test/pleroma/web/web_finger/web_finger_controller_test.exs
@@ -30,14 +30,24 @@ test "GET host-meta" do
end
test "Webfinger JRD" do
- user = insert(:user)
+ user =
+ insert(:user,
+ ap_id: "https://hyrule.world/users/zelda",
+ also_known_as: ["https://mushroom.kingdom/users/toad"]
+ )
response =
build_conn()
|> put_req_header("accept", "application/jrd+json")
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
+ |> json_response(200)
- assert json_response(response, 200)["subject"] == "acct:#{user.nickname}@localhost"
+ assert response["subject"] == "acct:#{user.nickname}@localhost"
+
+ assert response["aliases"] == [
+ "https://hyrule.world/users/zelda",
+ "https://mushroom.kingdom/users/toad"
+ ]
end
test "it returns 404 when user isn't found (JSON)" do
@@ -51,14 +61,20 @@ test "it returns 404 when user isn't found (JSON)" do
end
test "Webfinger XML" do
- user = insert(:user)
+ user =
+ insert(:user,
+ ap_id: "https://hyrule.world/users/zelda",
+ also_known_as: ["https://mushroom.kingdom/users/toad"]
+ )
response =
build_conn()
|> put_req_header("accept", "application/xrd+xml")
|> get("/.well-known/webfinger?resource=acct:#{user.nickname}@localhost")
+ |> response(200)
- assert response(response, 200)
+ assert response =~ "https://hyrule.world/users/zelda "
+ assert response =~ "https://mushroom.kingdom/users/toad "
end
test "it returns 404 when user isn't found (XML)" do
diff --git a/test/pleroma/web/web_finger_test.exs b/test/pleroma/web/web_finger_test.exs
index 96fc0bbaa..cdb84ae1e 100644
--- a/test/pleroma/web/web_finger_test.exs
+++ b/test/pleroma/web/web_finger_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.WebFingerTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.Web.WebFinger
import Pleroma.Factory
import Tesla.Mock
@@ -56,12 +56,13 @@ test "returns the ActivityPub actor URI for an ActivityPub user" do
{:ok, _data} = WebFinger.finger(user)
end
- test "returns the ActivityPub actor URI for an ActivityPub user with the ld+json mimetype" do
+ test "returns the ActivityPub actor URI and subscribe address for an ActivityPub user with the ld+json mimetype" do
user = "kaniini@gerzilla.de"
{:ok, data} = WebFinger.finger(user)
assert data["ap_id"] == "https://gerzilla.de/channel/kaniini"
+ assert data["subscribe_address"] == "https://gerzilla.de/follow?f=&url={uri}"
end
test "it work for AP-only user" do
diff --git a/test/pleroma/workers/cron/new_users_digest_worker_test.exs b/test/pleroma/workers/cron/new_users_digest_worker_test.exs
index 129534cb1..e00ed6745 100644
--- a/test/pleroma/workers/cron/new_users_digest_worker_test.exs
+++ b/test/pleroma/workers/cron/new_users_digest_worker_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
import Pleroma.Factory
alias Pleroma.Tests.ObanHelpers
@@ -28,7 +28,7 @@ test "it sends new users digest emails" do
assert email.html_body =~ user.nickname
assert email.html_body =~ user2.nickname
assert email.html_body =~ "cofe"
- assert email.html_body =~ "#{Pleroma.Web.Endpoint.url()}/static/logo.png"
+ assert email.html_body =~ "#{Pleroma.Web.Endpoint.url()}/static/logo.svg"
end
test "it doesn't fail when admin has no email" do
diff --git a/test/pleroma/xml_builder_test.exs b/test/pleroma/xml_builder_test.exs
index 059384c34..a4c73359d 100644
--- a/test/pleroma/xml_builder_test.exs
+++ b/test/pleroma/xml_builder_test.exs
@@ -3,7 +3,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.XmlBuilderTest do
- use Pleroma.DataCase
+ use Pleroma.DataCase, async: true
alias Pleroma.XmlBuilder
test "Build a basic xml string from a tuple" do
diff --git a/test/support/cachex_proxy.ex b/test/support/cachex_proxy.ex
new file mode 100644
index 000000000..e296b5c6a
--- /dev/null
+++ b/test/support/cachex_proxy.ex
@@ -0,0 +1,40 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.CachexProxy do
+ @behaviour Pleroma.Caching
+
+ @impl true
+ defdelegate get!(cache, key), to: Cachex
+
+ @impl true
+ defdelegate stream!(cache, key), to: Cachex
+
+ @impl true
+ defdelegate put(cache, key, value, options), to: Cachex
+
+ @impl true
+ defdelegate put(cache, key, value), to: Cachex
+
+ @impl true
+ defdelegate get_and_update(cache, key, func), to: Cachex
+
+ @impl true
+ defdelegate get(cache, key), to: Cachex
+
+ @impl true
+ defdelegate fetch!(cache, key, func), to: Cachex
+
+ @impl true
+ defdelegate expire_at(cache, str, num), to: Cachex
+
+ @impl true
+ defdelegate exists?(cache, key), to: Cachex
+
+ @impl true
+ defdelegate del(cache, key), to: Cachex
+
+ @impl true
+ defdelegate execute!(cache, func), to: Cachex
+end
diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex
index 114184a9f..f4696adb3 100644
--- a/test/support/channel_case.ex
+++ b/test/support/channel_case.ex
@@ -33,8 +33,14 @@ defmodule Pleroma.Web.ChannelCase do
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
- unless tags[:async] do
+ if tags[:async] do
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache)
+ Mox.set_mox_private()
+ else
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy)
+ Mox.set_mox_global()
+ Pleroma.DataCase.clear_cachex()
end
:ok
diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex
index 47cb65a80..f20e3d955 100644
--- a/test/support/conn_case.ex
+++ b/test/support/conn_case.ex
@@ -116,12 +116,16 @@ defp json_response_and_validate_schema(conn, _status) do
end
setup tags do
- Cachex.clear(:user_cache)
- Cachex.clear(:object_cache)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
- unless tags[:async] do
+ if tags[:async] do
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache)
+ Mox.set_mox_private()
+ else
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy)
+ Mox.set_mox_global()
+ Pleroma.DataCase.clear_cachex()
end
if tags[:needs_streamer] do
@@ -132,6 +136,10 @@ defp json_response_and_validate_schema(conn, _status) do
})
end
+ Pleroma.DataCase.stub_pipeline()
+
+ Mox.verify_on_exit!()
+
{:ok, conn: Phoenix.ConnTest.build_conn()}
end
end
diff --git a/test/support/data_case.ex b/test/support/data_case.ex
index d5456521c..0b41f0f63 100644
--- a/test/support/data_case.ex
+++ b/test/support/data_case.ex
@@ -45,13 +45,34 @@ defp oauth_access(scopes, opts \\ []) do
end
end
+ def clear_cachex do
+ Pleroma.Supervisor
+ |> Supervisor.which_children()
+ |> Enum.each(fn
+ {name, _, _, [Cachex]} ->
+ name
+ |> to_string
+ |> String.trim_leading("cachex_")
+ |> Kernel.<>("_cache")
+ |> String.to_existing_atom()
+ |> Cachex.clear()
+
+ _ ->
+ nil
+ end)
+ end
+
setup tags do
- Cachex.clear(:user_cache)
- Cachex.clear(:object_cache)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Pleroma.Repo)
- unless tags[:async] do
+ if tags[:async] do
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.NullCache)
+ Mox.set_mox_private()
+ else
Ecto.Adapters.SQL.Sandbox.mode(Pleroma.Repo, {:shared, self()})
+ Mox.stub_with(Pleroma.CachexMock, Pleroma.CachexProxy)
+ Mox.set_mox_global()
+ clear_cachex()
end
if tags[:needs_streamer] do
@@ -62,9 +83,27 @@ defp oauth_access(scopes, opts \\ []) do
})
end
+ stub_pipeline()
+
+ Mox.verify_on_exit!()
+
:ok
end
+ def stub_pipeline do
+ Mox.stub_with(Pleroma.Web.ActivityPub.SideEffectsMock, Pleroma.Web.ActivityPub.SideEffects)
+
+ Mox.stub_with(
+ Pleroma.Web.ActivityPub.ObjectValidatorMock,
+ Pleroma.Web.ActivityPub.ObjectValidator
+ )
+
+ Mox.stub_with(Pleroma.Web.ActivityPub.MRFMock, Pleroma.Web.ActivityPub.MRF)
+ Mox.stub_with(Pleroma.Web.ActivityPub.ActivityPubMock, Pleroma.Web.ActivityPub.ActivityPub)
+ Mox.stub_with(Pleroma.Web.FederatorMock, Pleroma.Web.Federator)
+ Mox.stub_with(Pleroma.ConfigMock, Pleroma.Config)
+ end
+
def ensure_local_uploader(context) do
test_uploader = Map.get(context, :uploader, Pleroma.Uploaders.Local)
uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
diff --git a/test/support/factory.ex b/test/support/factory.ex
index 80b882ee4..8eb07dc3c 100644
--- a/test/support/factory.ex
+++ b/test/support/factory.ex
@@ -24,7 +24,7 @@ def conversation_factory do
}
end
- def user_factory do
+ def user_factory(attrs \\ %{}) do
user = %User{
name: sequence(:name, &"Test テスト User #{&1}"),
email: sequence(:email, &"user#{&1}@example.com"),
@@ -39,13 +39,29 @@ def user_factory do
ap_enabled: true
}
- %{
- user
- | ap_id: User.ap_id(user),
- follower_address: User.ap_followers(user),
- following_address: User.ap_following(user),
- raw_bio: user.bio
- }
+ urls =
+ if attrs[:local] == false do
+ base_domain = Enum.random(["domain1.com", "domain2.com", "domain3.com"])
+
+ ap_id = "https://#{base_domain}/users/#{user.nickname}"
+
+ %{
+ ap_id: ap_id,
+ follower_address: ap_id <> "/followers",
+ following_address: ap_id <> "/following"
+ }
+ else
+ %{
+ ap_id: User.ap_id(user),
+ follower_address: User.ap_followers(user),
+ following_address: User.ap_following(user)
+ }
+ end
+
+ user
+ |> Map.put(:raw_bio, user.bio)
+ |> Map.merge(urls)
+ |> merge_attributes(attrs)
end
def user_relationship_factory(attrs \\ %{}) do
diff --git a/test/support/helpers.ex b/test/support/helpers.ex
index ecd4b1e18..15e8cbd9d 100644
--- a/test/support/helpers.ex
+++ b/test/support/helpers.ex
@@ -55,6 +55,14 @@ defmacro __using__(_opts) do
clear_config: 2
]
+ def time_travel(entity, seconds) do
+ new_time = NaiveDateTime.add(entity.inserted_at, seconds)
+
+ entity
+ |> Ecto.Changeset.change(%{inserted_at: new_time, updated_at: new_time})
+ |> Pleroma.Repo.update()
+ end
+
def to_datetime(%NaiveDateTime{} = naive_datetime) do
naive_datetime
|> DateTime.from_naive!("Etc/UTC")
@@ -85,8 +93,8 @@ def render_json(view, template, assigns) do
assigns = Map.new(assigns)
view.render(template, assigns)
- |> Poison.encode!()
- |> Poison.decode!()
+ |> Jason.encode!()
+ |> Jason.decode!()
end
def stringify_keys(nil), do: nil
diff --git a/test/support/http_request_mock.ex b/test/support/http_request_mock.ex
index cb022333f..93464ebff 100644
--- a/test/support/http_request_mock.ex
+++ b/test/support/http_request_mock.ex
@@ -5,6 +5,8 @@
defmodule HttpRequestMock do
require Logger
+ def activitypub_object_headers, do: [{"content-type", "application/activity+json"}]
+
def request(
%Tesla.Env{
url: url,
@@ -34,7 +36,8 @@ def get("https://osada.macgirvin.com/channel/mike", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___osada.macgirvin.com_channel_mike.json")
+ body: File.read!("test/fixtures/tesla_mock/https___osada.macgirvin.com_channel_mike.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -42,7 +45,8 @@ def get("https://shitposter.club/users/moonman", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/moonman@shitposter.club.json")
+ body: File.read!("test/fixtures/tesla_mock/moonman@shitposter.club.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -50,7 +54,8 @@ def get("https://mastodon.social/users/emelie/statuses/101849165031453009", _, _
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/status.emelie.json")
+ body: File.read!("test/fixtures/tesla_mock/status.emelie.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -66,7 +71,8 @@ def get("https://mastodon.social/users/emelie", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/emelie.json")
+ body: File.read!("test/fixtures/tesla_mock/emelie.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -78,7 +84,8 @@ def get("https://mastodon.sdf.org/users/rinpatch", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/rinpatch.json")
+ body: File.read!("test/fixtures/tesla_mock/rinpatch.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -86,7 +93,8 @@ def get("https://patch.cx/objects/tesla_mock/poll_attachment", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/poll_attachment.json")
+ body: File.read!("test/fixtures/tesla_mock/poll_attachment.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -99,7 +107,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/webfinger_emelie.json")
+ body: File.read!("test/fixtures/tesla_mock/webfinger_emelie.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -112,7 +121,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mike@osada.macgirvin.com.json")
+ body: File.read!("test/fixtures/tesla_mock/mike@osada.macgirvin.com.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -190,7 +200,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/lucifermysticus.json")
+ body: File.read!("test/fixtures/tesla_mock/lucifermysticus.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -198,7 +209,8 @@ def get("https://prismo.news/@mxb", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___prismo.news__mxb.json")
+ body: File.read!("test/fixtures/tesla_mock/https___prismo.news__mxb.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -211,7 +223,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/kaniini@hubzilla.example.org.json")
+ body: File.read!("test/fixtures/tesla_mock/kaniini@hubzilla.example.org.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -219,7 +232,8 @@ def get("https://niu.moe/users/rye", _, _, [{"accept", "application/activity+jso
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/rye.json")
+ body: File.read!("test/fixtures/tesla_mock/rye.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -227,7 +241,8 @@ def get("https://n1u.moe/users/rye", _, _, [{"accept", "application/activity+jso
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/rye.json")
+ body: File.read!("test/fixtures/tesla_mock/rye.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -246,7 +261,8 @@ def get("https://puckipedia.com/", _, _, [{"accept", "application/activity+json"
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/puckipedia.com.json")
+ body: File.read!("test/fixtures/tesla_mock/puckipedia.com.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -254,7 +270,8 @@ def get("https://peertube.moe/accounts/7even", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/7even.json")
+ body: File.read!("test/fixtures/tesla_mock/7even.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -262,7 +279,8 @@ def get("https://peertube.moe/videos/watch/df5f464b-be8d-46fb-ad81-2d4c2d1630e3"
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/peertube.moe-vid.json")
+ body: File.read!("test/fixtures/tesla_mock/peertube.moe-vid.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -270,7 +288,8 @@ def get("https://framatube.org/accounts/framasoft", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https___framatube.org_accounts_framasoft.json")
+ body: File.read!("test/fixtures/tesla_mock/https___framatube.org_accounts_framasoft.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -278,7 +297,8 @@ def get("https://framatube.org/videos/watch/6050732a-8a7a-43d4-a6cd-809525a1d206
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/framatube.org-video.json")
+ body: File.read!("test/fixtures/tesla_mock/framatube.org-video.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -286,7 +306,8 @@ def get("https://peertube.social/accounts/craigmaloney", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/craigmaloney.json")
+ body: File.read!("test/fixtures/tesla_mock/craigmaloney.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -294,7 +315,8 @@ def get("https://peertube.social/videos/watch/278d2b7c-0f38-4aaa-afe6-9ecc0c4a34
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/peertube-social.json")
+ body: File.read!("test/fixtures/tesla_mock/peertube-social.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -304,7 +326,8 @@ def get("https://mobilizon.org/events/252d5816-00a3-4a89-a66f-15bf65c33e39", _,
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json")
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-event.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -312,7 +335,8 @@ def get("https://mobilizon.org/@tcit", _, _, [{"accept", "application/activity+j
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json")
+ body: File.read!("test/fixtures/tesla_mock/mobilizon.org-user.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -320,7 +344,8 @@ def get("https://baptiste.gelez.xyz/@/BaptisteGelez", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-user.json")
+ body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-user.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -328,7 +353,8 @@ def get("https://baptiste.gelez.xyz/~/PlumeDevelopment/this-month-in-plume-june-
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-article.json")
+ body: File.read!("test/fixtures/tesla_mock/baptiste.gelex.xyz-article.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -336,7 +362,8 @@ def get("https://wedistribute.org/wp-json/pterotype/v1/object/85810", _, _, _) d
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/wedistribute-article.json")
+ body: File.read!("test/fixtures/tesla_mock/wedistribute-article.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -344,7 +371,8 @@ def get("https://wedistribute.org/wp-json/pterotype/v1/actor/-blog", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json")
+ body: File.read!("test/fixtures/tesla_mock/wedistribute-user.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -352,7 +380,8 @@ def get("http://mastodon.example.org/users/admin", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/admin@mastdon.example.org.json")
+ body: File.read!("test/fixtures/tesla_mock/admin@mastdon.example.org.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -362,7 +391,8 @@ def get("http://mastodon.example.org/users/relay", _, _, [
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/relay@mastdon.example.org.json")
+ body: File.read!("test/fixtures/tesla_mock/relay@mastdon.example.org.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -482,7 +512,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json")
+ body: File.read!("test/fixtures/tesla_mock/pekorino@pawoo.net_host_meta.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -543,7 +574,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/mastodon-note-object.json")
+ body: File.read!("test/fixtures/mastodon-note-object.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -567,7 +599,8 @@ def get("https://mstdn.io/users/mayuutann", _, _, [{"accept", "application/activ
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mayumayu.json")
+ body: File.read!("test/fixtures/tesla_mock/mayumayu.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -580,7 +613,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/mayumayupost.json")
+ body: File.read!("test/fixtures/tesla_mock/mayumayupost.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -795,7 +829,8 @@ def get(
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/winterdienst_webfinger.json")
+ body: File.read!("test/fixtures/tesla_mock/winterdienst_webfinger.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -867,12 +902,21 @@ def get("https://social.heldscal.la/.well-known/host-meta", _, _, _) do
end
def get("https://mastodon.social/users/lambadalambda", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/lambadalambda.json")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/lambadalambda.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("https://apfed.club/channel/indio", _, _, _) do
{:ok,
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/osada-user-indio.json")}}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/osada-user-indio.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("https://social.heldscal.la/user/23211", _, _, [{"accept", "application/activity+json"}]) do
@@ -895,7 +939,8 @@ def get("http://localhost:4001/users/masto_closed/followers", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/masto_closed_followers.json")
+ body: File.read!("test/fixtures/users_mock/masto_closed_followers.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -903,7 +948,8 @@ def get("http://localhost:4001/users/masto_closed/followers?page=1", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/masto_closed_followers_page.json")
+ body: File.read!("test/fixtures/users_mock/masto_closed_followers_page.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -911,7 +957,8 @@ def get("http://localhost:4001/users/masto_closed/following", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/masto_closed_following.json")
+ body: File.read!("test/fixtures/users_mock/masto_closed_following.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -919,7 +966,8 @@ def get("http://localhost:4001/users/masto_closed/following?page=1", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/masto_closed_following_page.json")
+ body: File.read!("test/fixtures/users_mock/masto_closed_following_page.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -927,7 +975,8 @@ def get("http://localhost:8080/followers/fuser3", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/friendica_followers.json")
+ body: File.read!("test/fixtures/users_mock/friendica_followers.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -935,7 +984,8 @@ def get("http://localhost:8080/following/fuser3", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/friendica_following.json")
+ body: File.read!("test/fixtures/users_mock/friendica_following.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -943,7 +993,8 @@ def get("http://localhost:4001/users/fuser2/followers", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/pleroma_followers.json")
+ body: File.read!("test/fixtures/users_mock/pleroma_followers.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -951,7 +1002,8 @@ def get("http://localhost:4001/users/fuser2/following", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/users_mock/pleroma_following.json")
+ body: File.read!("test/fixtures/users_mock/pleroma_following.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -1049,7 +1101,8 @@ def get("https://info.pleroma.site/activity.json", _, _, [
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity.json")
+ body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -1063,7 +1116,8 @@ def get("https://info.pleroma.site/activity2.json", _, _, [
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity2.json")
+ body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity2.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -1077,7 +1131,8 @@ def get("https://info.pleroma.site/activity3.json", _, _, [
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity3.json")
+ body: File.read!("test/fixtures/tesla_mock/https__info.pleroma.site_activity3.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -1110,7 +1165,12 @@ def get("https://www.patreon.com/posts/mastodon-2-9-and-28121681", _, _, _) do
end
def get("http://mastodon.example.org/@admin/99541947525187367", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/mastodon-post-activity.json")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/mastodon-post-activity.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("https://info.pleroma.site/activity4.json", _, _, _) do
@@ -1137,7 +1197,8 @@ def get("https://skippers-bin.com/notes/7x9tmrp97i", _, _, _) do
{:ok,
%Tesla.Env{
status: 200,
- body: File.read!("test/fixtures/tesla_mock/misskey_poll_no_end_date.json")
+ body: File.read!("test/fixtures/tesla_mock/misskey_poll_no_end_date.json"),
+ headers: activitypub_object_headers()
}}
end
@@ -1146,11 +1207,21 @@ def get("https://example.org/emoji/firedfox.png", _, _, _) do
end
def get("https://skippers-bin.com/users/7v1w1r8ce6", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/sjw.json")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/sjw.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("https://patch.cx/users/rin", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/rin.json")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/rin.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get(
@@ -1160,12 +1231,20 @@ def get(
_
) do
{:ok,
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_audio.json")}}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/funkwhale_audio.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("https://channels.tests.funkwhale.audio/federation/actors/compositions", _, _, _) do
{:ok,
- %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json")}}
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/tesla_mock/funkwhale_channel.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("http://example.com/rel_me/error", _, _, _) do
@@ -1173,7 +1252,12 @@ def get("http://example.com/rel_me/error", _, _, _) do
end
def get("https://relay.mastodon.host/actor", _, _, _) do
- {:ok, %Tesla.Env{status: 200, body: File.read!("test/fixtures/relay/relay.json")}}
+ {:ok,
+ %Tesla.Env{
+ status: 200,
+ body: File.read!("test/fixtures/relay/relay.json"),
+ headers: activitypub_object_headers()
+ }}
end
def get("http://localhost:4001/", _, "", [{"accept", "text/html"}]) do
diff --git a/test/support/mocks.ex b/test/support/mocks.ex
new file mode 100644
index 000000000..442ff5b71
--- /dev/null
+++ b/test/support/mocks.ex
@@ -0,0 +1,30 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+Mox.defmock(Pleroma.CachexMock, for: Pleroma.Caching)
+
+Mox.defmock(Pleroma.Web.ActivityPub.ObjectValidatorMock,
+ for: Pleroma.Web.ActivityPub.ObjectValidator.Validating
+)
+
+Mox.defmock(Pleroma.Web.ActivityPub.MRFMock,
+ for: Pleroma.Web.ActivityPub.MRF.PipelineFiltering
+)
+
+Mox.defmock(Pleroma.Web.ActivityPub.ActivityPubMock,
+ for: [
+ Pleroma.Web.ActivityPub.ActivityPub.Persisting,
+ Pleroma.Web.ActivityPub.ActivityPub.Streaming
+ ]
+)
+
+Mox.defmock(Pleroma.Web.ActivityPub.SideEffectsMock,
+ for: Pleroma.Web.ActivityPub.SideEffects.Handling
+)
+
+Mox.defmock(Pleroma.Web.FederatorMock, for: Pleroma.Web.Federator.Publishing)
+
+Mox.defmock(Pleroma.ConfigMock, for: Pleroma.Config.Getting)
+
+Mox.defmock(Pleroma.LoggerMock, for: Pleroma.Logging)
diff --git a/test/support/null_cache.ex b/test/support/null_cache.ex
new file mode 100644
index 000000000..c63df6a39
--- /dev/null
+++ b/test/support/null_cache.ex
@@ -0,0 +1,49 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2020 Pleroma Authors
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.NullCache do
+ @moduledoc """
+ A module simulating a permanently empty cache.
+ """
+ @behaviour Pleroma.Caching
+
+ @impl true
+ def get!(_, _), do: nil
+
+ @impl true
+ def put(_, _, _, _ \\ nil), do: {:ok, true}
+
+ @impl true
+ def stream!(_, _), do: []
+
+ @impl true
+ def get(_, _), do: {:ok, nil}
+
+ @impl true
+ def fetch!(_, key, func) do
+ case func.(key) do
+ {_, res} -> res
+ res -> res
+ end
+ end
+
+ @impl true
+ def get_and_update(_, _, func) do
+ func.(nil)
+ end
+
+ @impl true
+ def expire_at(_, _, _), do: {:ok, true}
+
+ @impl true
+ def exists?(_, _), do: {:ok, false}
+
+ @impl true
+ def execute!(_, func) do
+ func.(:nothing)
+ end
+
+ @impl true
+ def del(_, _), do: {:ok, true}
+end