Merge branch 'test-cases-mox-setup' into 'develop'
authorlain <lain@soykaf.club>
Thu, 21 Jan 2021 09:03:26 +0000 (09:03 +0000)
committerlain <lain@soykaf.club>
Thu, 21 Jan 2021 09:03:26 +0000 (09:03 +0000)
Mox mode setup tweak; refactoring

See merge request pleroma/pleroma!3263

34 files changed:
CHANGELOG.md
config/config.exs
config/description.exs
config/test.exs
docs/configuration/cheatsheet.md
docs/configuration/postgresql.md
docs/installation/otp_en.md
lib/mix/pleroma.ex
lib/pleroma/config/deprecation_warnings.ex
lib/pleroma/upload.ex
lib/pleroma/user.ex
lib/pleroma/user/query.ex
mix.exs
mix.lock
priv/gettext/pt_PT/LC_MESSAGES/errors.po [new file with mode: 0644]
priv/repo/migrations/20190730055101_add_oban_jobs_table.exs
priv/repo/migrations/20190917100019_update_oban.exs
priv/repo/migrations/20200402063221_update_oban_jobs_table.exs
priv/repo/migrations/20200825061316_move_activity_expirations_to_oban.exs
priv/repo/migrations/20200907092050_move_tokens_expiration_into_oban.exs
priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs [new file with mode: 0644]
priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs [new file with mode: 0644]
priv/templates/sample_config.eex
test/pleroma/config/deprecation_warnings_test.exs
test/pleroma/object_test.exs
test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs [new file with mode: 0644]
test/pleroma/scheduled_activity_test.exs
test/pleroma/upload_test.exs
test/pleroma/uploaders/s3_test.exs
test/pleroma/user/backup_test.exs
test/pleroma/user_test.exs
test/pleroma/web/activity_pub/side_effects_test.exs
test/support/data_case.ex
test/support/helpers.ex

index 50d5f80e3de012df2cf83f04059356bafdb50e32..76eab51d437c9ba2e53029c4e20a79c0d823e50a 100644 (file)
@@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Search: When using Postgres 11+, Pleroma will use the `websearch_to_tsvector` function to parse search queries.
 - Emoji: Support the full Unicode 13.1 set of Emoji for reactions, plus regional indicators.
 - Admin API: Reports now ordered by newest
+- Deprecated `Pleroma.Uploaders.S3, :public_endpoint`. Now `Pleroma.Upload, :base_url` is the standard configuration key for all uploaders.
 
 ### Added
 
@@ -50,6 +51,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - Users with `is_discoverable` field set to false (default value) will appear in in-service search results but be hidden from external services (search bots etc.).
 - Streaming API: Posts and notifications are not dropped, when CLI task is executing.
 - Creating incorrect IPv4 address-style HTTP links when encountering certain numbers.
+- Reblog API Endpoint: Do not set visibility parameter to public by default and let CommonAPI to infer it from status, so a user can reblog their private status without explicitly setting reblog visibility to private.
 
 <details>
   <summary>API Changes</summary>
@@ -59,8 +61,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
 ## Unreleased (Patch)
 
+
+## [2.2.2] - 2020-01-18
+
 ### Fixed
+
 - StealEmojiPolicy creates dir for emojis, if it doesn't exist.
+- Updated `elixir_make` to a non-retired version
+
+### Upgrade notes
+
+1. Restart Pleroma
 
 ## [2.2.1] - 2020-12-22
 
index db45f7a3d83aeeac1242f9e8accf50769964b614..70d0c2c2ba0734ea283cd8341e582d6ae948f428 100644 (file)
@@ -64,14 +64,23 @@ config :pleroma, Pleroma.Upload,
   link_name: false,
   proxy_remote: false,
   filename_display_max_length: 30,
-  default_description: nil
+  default_description: nil,
+  base_url: nil
 
 config :pleroma, Pleroma.Uploaders.Local, uploads: "uploads"
 
 config :pleroma, Pleroma.Uploaders.S3,
   bucket: nil,
-  streaming_enabled: true,
-  public_endpoint: "https://s3.amazonaws.com"
+  bucket_namespace: nil,
+  truncated_namespace: nil,
+  streaming_enabled: true
+
+config :ex_aws, :s3,
+  # host: "s3.wasabisys.com", # required if not Amazon AWS
+  access_key_id: nil,
+  secret_access_key: nil,
+  # region: "us-east-1", # may be required for Amazon AWS
+  scheme: "https://"
 
 config :pleroma, :emoji,
   shortcode_globs: ["/emoji/custom/**/*.png"],
index f438a88abc10a394670705f9aca9fb9a77a8e67d..493d362d3b5407359cb44b786fb2b0d5dbc54b90 100644 (file)
@@ -149,18 +149,12 @@ config :pleroma, :config_description, [
         description: "S3 bucket namespace",
         suggestions: ["pleroma"]
       },
-      %{
-        key: :public_endpoint,
-        type: :string,
-        description: "S3 endpoint",
-        suggestions: ["https://s3.amazonaws.com"]
-      },
       %{
         key: :truncated_namespace,
         type: :string,
         description:
           "If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or \"\" etc." <>
-            " For example, when using CDN to S3 virtual host format, set \"\". At this time, write CNAME to CDN in public_endpoint."
+            " For example, when using CDN to S3 virtual host format, set \"\". At this time, write CNAME to CDN in Upload base_url."
       },
       %{
         key: :streaming_enabled,
index 6f6b18558a0fa27d63dccbb49c87ebf85b879ff6..690c98e40e909b6b3ff4aaa8f85f655f9727c5df 100644 (file)
@@ -115,11 +115,6 @@ config :pleroma, Pleroma.Web.Plugs.RemoteIp, enabled: false
 
 config :pleroma, Pleroma.Web.ApiSpec.CastAndValidate, strict: true
 
-config :pleroma, Pleroma.Uploaders.S3,
-  bucket: nil,
-  streaming_enabled: true,
-  public_endpoint: nil
-
 config :tzdata, :autoupdate, :disabled
 
 config :pleroma, :mrf, policies: []
index 85551362cedd64b84ceb1284609fdd07381ad27e..c7d8a2dae8345814ae3618a94bcda67e49755707 100644 (file)
@@ -549,7 +549,7 @@ the source code is here: [kocaptcha](https://github.com/koto-bank/kocaptcha). Th
 * `uploader`: Which one of the [uploaders](#uploaders) to use.
 * `filters`: List of [upload filters](#upload-filters) to use.
 * `link_name`: When enabled Pleroma will add a `name` parameter to the url of the upload, for example `https://instance.tld/media/corndog.png?name=corndog.png`. This is needed to provide the correct filename in Content-Disposition headers when using filters like `Pleroma.Upload.Filter.Dedupe`
-* `base_url`: The base URL to access a user-uploaded file. Useful when you want to proxy the media files via another host.
+* `base_url`: The base URL to access a user-uploaded file. Useful when you want to host the media files via another domain or are using a 3rd party S3 provider.
 * `proxy_remote`: If you're using a remote uploader, Pleroma will proxy media requests instead of redirecting to it.
 * `proxy_opts`: Proxy options, see `Pleroma.ReverseProxy` documentation.
 * `filename_display_max_length`: Set max length of a filename to display. 0 = no limit. Default: 30.
@@ -570,10 +570,7 @@ Don't forget to configure [Ex AWS S3](#ex-aws-s3-settings)
 
 * `bucket`: S3 bucket name.
 * `bucket_namespace`: S3 bucket namespace.
-* `public_endpoint`: S3 endpoint that the user finally accesses(ex. "https://s3.dualstack.ap-northeast-1.amazonaws.com")
 * `truncated_namespace`: If you use S3 compatible service such as Digital Ocean Spaces or CDN, set folder name or "" etc.
-For example, when using CDN to S3 virtual host format, set "".
-At this time, write CNAME to CDN in public_endpoint.
 * `streaming_enabled`: Enable streaming uploads, when enabled the file will be sent to the server in chunks as it's being read. This may be unsupported by some providers, try disabling this if you have upload problems.
 
 #### Ex AWS S3 settings
index 6983fb4597640964d4b2f4d051c07fee41bacf22..e251eb83b25217800099bc8693199843c6da13fa 100644 (file)
@@ -1,10 +1,28 @@
-# Optimizing your PostgreSQL performance
+# Optimizing PostgreSQL performance
 
-Pleroma performance depends to a large extent on good database performance. The default PostgreSQL settings are mostly fine, but often you can get better performance by changing a few settings.
+Pleroma performance is largely dependent on performance of the underlying database. Better performance can be achieved by adjusting a few settings.
 
-You can use [PGTune](https://pgtune.leopard.in.ua) to get recommendations for your setup. If you do, set the "Number of Connections" field to 20, as Pleroma will only use 10 concurrent connections anyway. If you don't, it will give you advice that might even hurt your performance.
+## PGTune
 
-We also recommend not using the "Network Storage" option.
+[PgTune](https://pgtune.leopard.in.ua) can be used to get recommended settings. Be sure to set "Number of Connections" to 20, otherwise it might produce settings hurtful to database performance. It is also recommended to not use "Network Storage" option.
+
+## Disable generic query plans
+
+When PostgreSQL receives a query, it decides on a strategy for searching the requested data, this is called a query plan. The query planner has two modes: generic and custom. Generic makes a plan for all queries of the same shape, ignoring the parameters, which is then cached and reused. Custom, on the contrary, generates a unique query plan based on query parameters.
+
+By default PostgreSQL has an algorithm to decide which mode is more efficient for particular query, however this algorithm has been observed to be wrong on some of the queries Pleroma sends, leading to serious performance loss. Therefore, it is recommended to disable generic mode.
+
+
+Pleroma already avoids generic query plans by default, however the method it uses is not the most efficient because it needs to be compatible with all supported PostgreSQL versions. For PostgreSQL 12 and higher additional performance can be gained by adding the following to Pleroma configuration:
+```elixir
+config :pleroma, Pleroma.Repo,
+  prepare: :named,
+  parameters: [
+    plan_cache_mode: "force_custom_plan"
+  ]
+```
+
+A more detailed explaination of the issue can be found at <https://blog.soykaf.com/post/postgresql-elixir-troubles/>.
 
 ## Example configurations
 
@@ -28,4 +46,3 @@ max_worker_processes = 2
 max_parallel_workers_per_gather = 1
 max_parallel_workers = 2
 ```
-
index 63eda63ca230a2cb6f4b2f2035d0ecf978debffb..f36b33c32ecd8431bad550d6d8997d16e1cc5955 100644 (file)
@@ -89,6 +89,8 @@ RUM indexes are an alternative indexing scheme that is not included in PostgreSQ
 #### (Optional) Performance configuration
 It is encouraged to check [Optimizing your PostgreSQL performance](../configuration/postgresql.md) document, for tips on PostgreSQL tuning.
 
+Restart PostgreSQL to apply configuration changes:
+
 === "Alpine"
     ```
     rc-service postgresql restart
@@ -99,17 +101,6 @@ It is encouraged to check [Optimizing your PostgreSQL performance](../configurat
     systemctl restart postgresql
     ```
 
-If you are using PostgreSQL 12 or higher, add this to your Ecto database configuration
-
-```elixir
-#
-config :pleroma, Pleroma.Repo,
-prepare: :named,
-parameters: [
-  plan_cache_mode: "force_custom_plan"
-]
-```
-
 ### Installing Pleroma
 ```sh
 # Create a Pleroma user
index 45d0ad6245e70979a5d0bd8ce224520a650ff6c8..2b6c7d6bbd13f364fefa396e66a778d6b480f2d6 100644 (file)
@@ -13,7 +13,8 @@ defmodule Mix.Pleroma do
     :flake_id,
     :swoosh,
     :timex,
-    :fast_html
+    :fast_html,
+    :oban
   ]
   @cachex_children ["object", "user", "scrubber", "web_resp"]
   @doc "Common functions to be reused in mix tasks"
index 382076c31e05cd5945af68a0f16a4cadcdd93910..24aa5993bae0aefd1201c8d6daea8bcf47f31565 100644 (file)
@@ -40,7 +40,8 @@ defmodule Pleroma.Config.DeprecationWarnings do
          :ok <- check_welcome_message_config(),
          :ok <- check_gun_pool_options(),
          :ok <- check_activity_expiration_config(),
-         :ok <- check_remote_ip_plug_name() do
+         :ok <- check_remote_ip_plug_name(),
+         :ok <- check_uploders_s3_public_endpoint() do
       :ok
     else
       _ ->
@@ -193,4 +194,25 @@ defmodule Pleroma.Config.DeprecationWarnings do
       warning_preface
     )
   end
+
+  @spec check_uploders_s3_public_endpoint() :: :ok | nil
+  def check_uploders_s3_public_endpoint do
+    s3_config = Pleroma.Config.get([Pleroma.Uploaders.S3])
+
+    use_old_config = Keyword.has_key?(s3_config, :public_endpoint)
+
+    if use_old_config do
+      Logger.error("""
+      !!!DEPRECATION WARNING!!!
+      Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket.\n
+      Please make the following change at your earliest convenience.\n
+      \n* `config :pleroma, Pleroma.Uploaders.S3, public_endpoint` is now equal to:
+      \n* `config :pleroma, Pleroma.Upload, base_url`
+      """)
+
+      :error
+    else
+      :ok
+    end
+  end
 end
index 00b61ca80230a2e65a57f416522ff9270365f220..6547113514b15fe3d74770f2fde3869930265223 100644 (file)
@@ -131,12 +131,7 @@ defmodule Pleroma.Upload do
       uploader: Keyword.get(opts, :uploader, Pleroma.Config.get([__MODULE__, :uploader])),
       filters: Keyword.get(opts, :filters, Pleroma.Config.get([__MODULE__, :filters])),
       description: Keyword.get(opts, :description),
-      base_url:
-        Keyword.get(
-          opts,
-          :base_url,
-          Pleroma.Config.get([__MODULE__, :base_url], Pleroma.Web.base_url())
-        )
+      base_url: base_url()
     }
   end
 
@@ -217,14 +212,7 @@ defmodule Pleroma.Upload do
           ""
         end
 
-    prefix =
-      if is_nil(Pleroma.Config.get([__MODULE__, :base_url])) do
-        "media"
-      else
-        ""
-      end
-
-    [base_url, prefix, path]
+    [base_url, path]
     |> Path.join()
   end
 
@@ -241,13 +229,15 @@ defmodule Pleroma.Upload do
 
       Pleroma.Uploaders.S3 ->
         bucket = Config.get([Pleroma.Uploaders.S3, :bucket])
+        truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace])
+        namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace])
 
         bucket_with_namespace =
           cond do
-            truncated_namespace = Config.get([Pleroma.Uploaders.S3, :truncated_namespace]) ->
+            !is_nil(truncated_namespace) ->
               truncated_namespace
 
-            namespace = Config.get([Pleroma.Uploaders.S3, :bucket_namespace]) ->
+            !is_nil(namespace) ->
               namespace <> ":" <> bucket
 
             true ->
@@ -261,7 +251,7 @@ defmodule Pleroma.Upload do
         end
 
       _ ->
-        public_endpoint || upload_base_url
+        public_endpoint || upload_base_url || Pleroma.Web.base_url() <> "/media/"
     end
   end
 end
index d81abbd2b7838131920d30e8a2955bdd7bf22507..2aeacf8160ade0629dde2e3feb69de80b6a43361 100644 (file)
@@ -289,15 +289,7 @@ defmodule Pleroma.User do
   def account_status(%User{deactivated: true}), do: :deactivated
   def account_status(%User{password_reset_pending: true}), do: :password_reset_pending
   def account_status(%User{local: true, is_approved: false}), do: :approval_pending
-
-  def account_status(%User{local: true, is_confirmed: false}) do
-    if Config.get([:instance, :account_activation_required]) do
-      :confirmation_pending
-    else
-      :active
-    end
-  end
-
+  def account_status(%User{local: true, is_confirmed: false}), do: :confirmation_pending
   def account_status(%User{}), do: :active
 
   @spec visible_for(User.t(), User.t() | nil) ::
index 74ef1158a3ac2db39e325b0ba2c33870125aa34b..4076925aaa1853a73ee5ce1680c1c1a8e3595786 100644 (file)
@@ -139,6 +139,7 @@ defmodule Pleroma.User.Query do
   defp compose_query({:active, _}, query) do
     User.restrict_deactivated(query)
     |> where([u], u.is_approved == true)
+    |> where([u], u.is_confirmed == true)
   end
 
   defp compose_query({:legacy_active, _}, query) do
diff --git a/mix.exs b/mix.exs
index 14448f12f9511361e1894587965340025cace090..489bb5729ba04a25d6a20793a2ce87720aa999ca 100644 (file)
--- a/mix.exs
+++ b/mix.exs
@@ -123,7 +123,7 @@ defmodule Pleroma.Mixfile do
       {:ecto_enum, "~> 1.4"},
       {:ecto_sql, "~> 3.4.4"},
       {:postgrex, ">= 0.15.5"},
-      {:oban, "~> 2.1.0"},
+      {:oban, "~> 2.3.4"},
       {:gettext, "~> 0.18"},
       {:bcrypt_elixir, "~> 2.2"},
       {:trailing_format_plug, "~> 0.0.7"},
@@ -229,7 +229,9 @@ defmodule Pleroma.Mixfile do
       "ecto.reset": ["ecto.drop", "ecto.setup"],
       test: ["ecto.create --quiet", "ecto.migrate", "test"],
       docs: ["pleroma.docs", "docs"],
-      analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"]
+      analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"],
+      copyright: &add_copyright/1,
+      "copyright.bump": &bump_copyright/1
     ]
   end
 
@@ -332,4 +334,30 @@ defmodule Pleroma.Mixfile do
     |> Enum.filter(fn string -> string && string != "" end)
     |> Enum.join()
   end
+
+  defp add_copyright(_) do
+    year = NaiveDateTime.utc_now().year
+    template = ~s[\
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+] |> String.replace("\n", "\\n")
+
+    find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\) -exec "
+    grep = "grep -L '# Copyright © [0-9\-]* Pleroma' {} \\;"
+    xargs = "xargs -n1 sed -i'' '1s;^;#{template};'"
+
+    :os.cmd(String.to_charlist("#{find}#{grep} | #{xargs}"))
+  end
+
+  defp bump_copyright(_) do
+    year = NaiveDateTime.utc_now().year
+    find = "find lib test priv -type f \\( -name '*.ex' -or -name '*.exs' \\)"
+
+    xargs =
+      "xargs sed -i'' 's;# Copyright © [0-9\-]* Pleroma.*$;# Copyright © 2017-#{year} Pleroma Authors <https://pleroma.social/>;'"
+
+    :os.cmd(String.to_charlist("#{find} | #{xargs}"))
+  end
 end
index 01caf319e471f4cca93b1a69eeeb9a6440ce0eb2..840a825557430bb2c66d5c7cf741562e1186454d 100644 (file)
--- a/mix.lock
+++ b/mix.lock
@@ -15,7 +15,7 @@
   "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"]},
-  "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"},
+  "connection": {:hex, :connection, "1.1.0", "ff2a49c4b75b6fb3e674bfc5536451607270aac754ffd1bdfe175abe4a6d7a68", [:mix], [], "hexpm", "722c1eb0a418fbe91ba7bd59a47e28008a189d47e37e0e7bb85585a016b2869c"},
   "cors_plug": {:hex, :cors_plug, "2.0.2", "2b46083af45e4bc79632bd951550509395935d3e7973275b2b743bd63cc942ce", [:mix], [{:plug, "~> 1.8", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "f0d0e13f71c51fd4ef8b2c7e051388e4dfb267522a83a22392c856de7e46465f"},
   "cowboy": {:hex, :cowboy, "2.8.0", "f3dc62e35797ecd9ac1b50db74611193c29815401e53bac9a5c0577bd7bc667d", [:rebar3], [{:cowlib, "~> 2.9.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.7.1", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "4643e4fba74ac96d4d152c75803de6fad0b3fa5df354c71afdd6cbeeb15fac8a"},
   "cowboy_telemetry": {:hex, :cowboy_telemetry, "0.3.0", "69fdb5cf92df6373e15675eb4018cf629f5d8e35e74841bb637d6596cb797bbc", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "42868c229d9a2900a1501c5d0355bfd46e24c862c322b0b4f5a6f14fe0216753"},
@@ -24,7 +24,7 @@
   "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://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"},
+  "db_connection": {:hex, :db_connection, "2.3.1", "4c9f3ed1ef37471cbdd2762d6655be11e38193904d9c5c1c9389f1b891a3088e", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}], "hexpm", "abaab61780dde30301d840417890bd9f74131041afd02174cf4e10635b3a63f5"},
   "decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
   "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"},
   "earmark": {:hex, :earmark, "1.4.3", "364ca2e9710f6bff494117dbbd53880d84bebb692dafc3a78eb50aa3183f2bfd", [:mix], [], "hexpm", "8cf8a291ebf1c7b9539e3cddb19e9cef066c2441b1640f13c34c1d3cfc825fec"},
@@ -81,7 +81,7 @@
   "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"},
   "nimble_pool": {:hex, :nimble_pool, "0.1.0", "ffa9d5be27eee2b00b0c634eb649aa27f97b39186fec3c493716c2a33e784ec6", [:mix], [], "hexpm", "343a1eaa620ddcf3430a83f39f2af499fe2370390d4f785cd475b4df5acaf3f9"},
   "nodex": {:git, "https://git.pleroma.social/pleroma/nodex", "cb6730f943cfc6aad674c92161be23a8411f15d1", [ref: "cb6730f943cfc6aad674c92161be23a8411f15d1"]},
-  "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"},
+  "oban": {:hex, :oban, "2.3.4", "ec7509b9af2524d55f529cb7aee93d36131ae0bf0f37706f65d2fe707f4d9fd8", [: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", "c70ca0434758fd1805422ea4446af5e910ddc697c0c861549c8f0eb0cfbd2fdf"},
   "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": {:git, "https://github.com/uwiger/parse_trans.git", "76abb347c3c1d00fb0ccf9e4b43e22b3d2288484", [tag: "3.3.0"]},
@@ -97,7 +97,7 @@
   "plug_static_index_html": {:hex, :plug_static_index_html, "1.0.0", "840123d4d3975585133485ea86af73cb2600afd7f2a976f9f5fd8b3808e636a0", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "79fd4fcf34d110605c26560cbae8f23c603ec4158c08298bd4360fdea90bb5cf"},
   "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm", "fec8660eb7733ee4117b85f55799fd3833eb769a6df71ccf8903e8dc5447cfce"},
   "poolboy": {:hex, :poolboy, "1.5.2", "392b007a1693a64540cead79830443abf5762f5d30cf50bc95cb2c1aaafa006b", [:rebar3], [], "hexpm", "dad79704ce5440f3d5a3681c8590b9dc25d1a561e8f5a9c995281012860901e3"},
-  "postgrex": {:hex, :postgrex, "0.15.6", "a464c72010a56e3214fe2b99c1a76faab4c2bb0255cabdef30dea763a3569aa2", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "f99268325ac8f66ffd6c4964faab9e70fbf721234ab2ad238c00f9530b8cdd55"},
+  "postgrex": {:hex, :postgrex, "0.15.7", "724410acd48abac529d0faa6c2a379fb8ae2088e31247687b16cacc0e0883372", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "88310c010ff047cecd73d5ceca1d99205e4b1ab1b9abfdab7e00f5c9d20ef8f9"},
   "pot": {:hex, :pot, "0.11.0", "61bad869a94534739dd4614a25a619bc5c47b9970e9a0ea5bef4628036fc7a16", [:rebar3], [], "hexpm", "57ee6ee6bdeb639661ffafb9acefe3c8f966e45394de6a766813bb9e1be4e54b"},
   "prometheus": {:hex, :prometheus, "4.6.0", "20510f381db1ccab818b4cf2fac5fa6ab5cc91bc364a154399901c001465f46f", [:mix, :rebar3], [], "hexpm", "4905fd2992f8038eccd7aa0cd22f40637ed618c0bed1f75c05aacec15b7545de"},
   "prometheus_ecto": {:hex, :prometheus_ecto, "1.4.3", "3dd4da1812b8e0dbee81ea58bb3b62ed7588f2eae0c9e97e434c46807ff82311", [:mix], [{:ecto, "~> 2.0 or ~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:prometheus_ex, "~> 1.1 or ~> 2.0 or ~> 3.0", [hex: :prometheus_ex, repo: "hexpm", optional: false]}], "hexpm", "8d66289f77f913b37eda81fd287340c17e61a447549deb28efc254532b2bed82"},
diff --git a/priv/gettext/pt_PT/LC_MESSAGES/errors.po b/priv/gettext/pt_PT/LC_MESSAGES/errors.po
new file mode 100644 (file)
index 0000000..16d8c97
--- /dev/null
@@ -0,0 +1,594 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2021-01-18 17:19+0000\n"
+"PO-Revision-Date: 2021-01-18 17:54+0000\n"
+"Last-Translator: João Rodrigues <joaoadriano3@gmail.com>\n"
+"Language-Team: Portuguese (Portugal) <https://translate.pleroma.social/"
+"projects/pleroma/pleroma/pt_PT/>\n"
+"Language: pt_PT\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n > 1;\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 "não pode estar em branco"
+
+## From Ecto.Changeset.unique_constraint/3
+msgid "has already been taken"
+msgstr "já se encontra em utilização"
+
+## From Ecto.Changeset.put_change/3
+msgid "is invalid"
+msgstr "é inválido"
+
+## From Ecto.Changeset.validate_format/3
+msgid "has invalid format"
+msgstr "tem um formato inválido"
+
+## From Ecto.Changeset.validate_subset/3
+msgid "has an invalid entry"
+msgstr "tem uma entrada inválida"
+
+## From Ecto.Changeset.validate_exclusion/3
+msgid "is reserved"
+msgstr "é reservado"
+
+## From Ecto.Changeset.validate_confirmation/3
+msgid "does not match confirmation"
+msgstr "não corresponde à confirmação"
+
+## From Ecto.Changeset.no_assoc_constraint/3
+msgid "is still associated with this entry"
+msgstr "ainda se encontra associado a esta entrada"
+
+msgid "are still associated with this entry"
+msgstr "ainda está associado a esta entrada"
+
+## From Ecto.Changeset.validate_length/3
+msgid "should be %{count} character(s)"
+msgid_plural "should be %{count} character(s)"
+msgstr[0] "deve conter %{count} caracter"
+msgstr[1] "deve conter %{count} caracteres"
+
+msgid "should have %{count} item(s)"
+msgid_plural "should have %{count} item(s)"
+msgstr[0] "deve ter %{count} item"
+msgstr[1] "deve ter %{count} items"
+
+msgid "should be at least %{count} character(s)"
+msgid_plural "should be at least %{count} character(s)"
+msgstr[0] "deve ter pelo menos %{count} caracter"
+msgstr[1] "deve ter pelo menos %{count} caracteres"
+
+msgid "should have at least %{count} item(s)"
+msgid_plural "should have at least %{count} item(s)"
+msgstr[0] "deve ter pelo menos %{count} item"
+msgstr[1] "deve ter pelo menos %{count} items"
+
+msgid "should be at most %{count} character(s)"
+msgid_plural "should be at most %{count} character(s)"
+msgstr[0] "deve ter pelo menos %{count} caracter"
+msgstr[1] "deve ter pelo menos %{count} caracteres"
+
+msgid "should have at most %{count} item(s)"
+msgid_plural "should have at most %{count} item(s)"
+msgstr[0] "deve ter pelo menos %{count} item"
+msgstr[1] "deve ter pelo menos %{count} items"
+
+## From Ecto.Changeset.validate_number/3
+msgid "must be less than %{number}"
+msgstr "deve ser menor que %{number}"
+
+msgid "must be greater than %{number}"
+msgstr "deve ser maior que %{number}"
+
+msgid "must be less than or equal to %{number}"
+msgstr "deve ser menor ou igual que %{number}"
+
+msgid "must be greater than or equal to %{number}"
+msgstr "deve ser maior ou igual que %{number}"
+
+msgid "must be equal to %{number}"
+msgstr "deve ser igual a %{number}"
+
+#: lib/pleroma/web/common_api/common_api.ex:505
+#, elixir-format
+msgid "Account not found"
+msgstr "Conta não encontrada"
+
+#: lib/pleroma/web/common_api/common_api.ex:339
+#, elixir-format
+msgid "Already voted"
+msgstr "Já votou"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:359
+#, elixir-format
+msgid "Bad request"
+msgstr "Pedido inválido"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:426
+#, elixir-format
+msgid "Can't delete object"
+msgstr "Não é possível apagar o objeto"
+
+#: lib/pleroma/web/controller_helper.ex:105
+#: lib/pleroma/web/controller_helper.ex:111
+#, elixir-format
+msgid "Can't display this activity"
+msgstr "Não é possível exibir esta atividade"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:285
+#, elixir-format
+msgid "Can't find user"
+msgstr "Não foi possível encontrar o utilizador"
+
+#: lib/pleroma/web/pleroma_api/controllers/account_controller.ex:61
+#, elixir-format
+msgid "Can't get favorites"
+msgstr "Não foi possível obter os favoritos"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:438
+#, elixir-format
+msgid "Can't like object"
+msgstr "Não foi possível gostar do objeto"
+
+#: lib/pleroma/web/common_api/utils.ex:563
+#, elixir-format
+msgid "Cannot post an empty status without attachments"
+msgstr "Não é possível publicar um estado vazio e sem ficheiro anexados"
+
+#: lib/pleroma/web/common_api/utils.ex:511
+#, elixir-format
+msgid "Comment must be up to %{max_size} characters"
+msgstr "Comentários devem ter até %{max_size} caracteres"
+
+#: lib/pleroma/config/config_db.ex:191
+#, elixir-format
+msgid "Config with params %{params} not found"
+msgstr "Configuração com parâmetros %{params} não encontrada"
+
+#: 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 "Não foi possível apagar"
+
+#: lib/pleroma/web/common_api/common_api.ex:231
+#, elixir-format
+msgid "Could not favorite"
+msgstr "Não foi possível favoritar"
+
+#: lib/pleroma/web/common_api/common_api.ex:453
+#, elixir-format
+msgid "Could not pin"
+msgstr "Não foi possível fixar"
+
+#: lib/pleroma/web/common_api/common_api.ex:278
+#, elixir-format
+msgid "Could not unfavorite"
+msgstr "Não foi possível retirar favorito"
+
+#: lib/pleroma/web/common_api/common_api.ex:463
+#, elixir-format
+msgid "Could not unpin"
+msgstr "Não foi possível desafixar"
+
+#: lib/pleroma/web/common_api/common_api.ex:216
+#, elixir-format
+msgid "Could not unrepeat"
+msgstr "Não foi possível deixar de repetir"
+
+#: 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 "Não foi possível atualizar estado"
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:207
+#, elixir-format
+msgid "Error."
+msgstr "Erro."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:106
+#, elixir-format
+msgid "Invalid CAPTCHA"
+msgstr "CAPTCHA Inválido"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:116
+#: lib/pleroma/web/oauth/oauth_controller.ex:568
+#, elixir-format
+msgid "Invalid credentials"
+msgstr "Credenciais inválidas"
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:38
+#, elixir-format
+msgid "Invalid credentials."
+msgstr "Credenciais inválidas."
+
+#: lib/pleroma/web/common_api/common_api.ex:355
+#, elixir-format
+msgid "Invalid indices"
+msgstr "Índices inválidos"
+
+#: lib/pleroma/web/admin_api/controllers/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid parameters"
+msgstr "Parâmetros inválidos"
+
+#: lib/pleroma/web/common_api/utils.ex:414
+#, elixir-format
+msgid "Invalid password."
+msgstr "Palavra-passe inválida."
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:220
+#, elixir-format
+msgid "Invalid request"
+msgstr "Pedido inválido"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:109
+#, elixir-format
+msgid "Kocaptcha service unavailable"
+msgstr "Serviço Kocaptcha indisponível"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:112
+#, elixir-format
+msgid "Missing parameters"
+msgstr "Parâmetros em falta"
+
+#: lib/pleroma/web/common_api/utils.ex:547
+#, elixir-format
+msgid "No such conversation"
+msgstr "Não existe tal conversação"
+
+#: 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 "Não existe 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 "Não encontrado"
+
+#: lib/pleroma/web/common_api/common_api.ex:331
+#, elixir-format
+msgid "Poll's author can't vote"
+msgstr "O autor da sondagem não pode votar"
+
+#: 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 "Registo não encontrado"
+
+#: 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 "Algo ocorreu de errado"
+
+#: lib/pleroma/web/common_api/activity_draft.ex:107
+#, elixir-format
+msgid "The message visibility must be direct"
+msgstr "A visibilidade da mensagem deve ser direta"
+
+#: lib/pleroma/web/common_api/utils.ex:573
+#, elixir-format
+msgid "The status is over the character limit"
+msgstr "O estado está acima do limite de caracteres"
+
+#: lib/pleroma/plugs/ensure_public_or_authenticated_plug.ex:31
+#, elixir-format
+msgid "This resource requires authentication."
+msgstr "Este recurso requer autenticação."
+
+#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
+#, elixir-format
+msgid "Throttled"
+msgstr "Limitado"
+
+#: lib/pleroma/web/common_api/common_api.ex:356
+#, elixir-format
+msgid "Too many choices"
+msgstr "Demasiadas opções"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:443
+#, elixir-format
+msgid "Unhandled activity type"
+msgstr "Tipo de atividade não controlada"
+
+#: lib/pleroma/web/admin_api/controllers/admin_api_controller.ex:485
+#, elixir-format
+msgid "You can't revoke your own admin status."
+msgstr "Não podes revogar o teu próprio estatuto de admin."
+
+#: 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 "A tua conta está atualmente desativada"
+
+#: 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 ""
+"O teu início de sessão necessita que tenhas o endereço de e-mail confirmado"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:390
+#, elixir-format
+msgid "can't read inbox of %{nickname} as %{as_nickname}"
+msgstr ""
+"não foi possível ler a caixa de entrada de %{nickname} como %{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 ""
+"não foi possível atualizar caixa de saída de %{nickname} como %{as_nickname}"
+
+#: lib/pleroma/web/common_api/common_api.ex:471
+#, elixir-format
+msgid "conversation is already muted"
+msgstr "conversação já silenciada"
+
+#: 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 "erro"
+
+#: lib/pleroma/web/pleroma_api/controllers/mascot_controller.ex:32
+#, elixir-format
+msgid "mascots can only be images"
+msgstr "mascotes apenas podem ser imagens"
+
+#: lib/pleroma/web/activity_pub/activity_pub_controller.ex:62
+#, elixir-format
+msgid "not found"
+msgstr "não encontrado"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:394
+#, elixir-format
+msgid "Bad OAuth request."
+msgstr "Pedido OAuth inválido."
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:115
+#, elixir-format
+msgid "CAPTCHA already used"
+msgstr "CPATCHA já utilizado"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:112
+#, elixir-format
+msgid "CAPTCHA expired"
+msgstr "CAPTCHA expirado"
+
+#: lib/pleroma/plugs/uploaded_media.ex:57
+#, elixir-format
+msgid "Failed"
+msgstr "Falhou"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:410
+#, elixir-format
+msgid "Failed to authenticate: %{message}."
+msgstr "Falha ao autenticar: %{message}."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:441
+#, elixir-format
+msgid "Failed to set up user account."
+msgstr "Falha ao configurar conta de utilizador."
+
+#: lib/pleroma/plugs/oauth_scopes_plug.ex:38
+#, elixir-format
+msgid "Insufficient permissions: %{permissions}."
+msgstr "Permissões insuficientes: %{permissions}."
+
+#: lib/pleroma/plugs/uploaded_media.ex:104
+#, elixir-format
+msgid "Internal Error"
+msgstr "Erro Interno"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:22
+#: lib/pleroma/web/oauth/fallback_controller.ex:29
+#, elixir-format
+msgid "Invalid Username/Password"
+msgstr "Nome de Utilizador/Palavra-passe inválidos"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:118
+#, elixir-format
+msgid "Invalid answer data"
+msgstr "Informação de resposta inválida"
+
+#: lib/pleroma/web/nodeinfo/nodeinfo_controller.ex:33
+#, elixir-format
+msgid "Nodeinfo schema version not handled"
+msgstr "Versão do schema de nodeinfo não tratado"
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:172
+#, elixir-format
+msgid "This action is outside the authorized scopes"
+msgstr "Esta ação está fora dos escopos autorizados"
+
+#: lib/pleroma/web/oauth/fallback_controller.ex:14
+#, elixir-format
+msgid "Unknown error, please check the details and try again."
+msgstr "Erro desconhecido, verifica os detalhes e tenta novamente."
+
+#: 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 não listado."
+
+#: lib/pleroma/web/oauth/oauth_controller.ex:390
+#, elixir-format
+msgid "Unsupported OAuth provider: %{provider}."
+msgstr "Portal OAuth não suportado: %{provider}."
+
+#: lib/pleroma/uploaders/uploader.ex:72
+#, elixir-format
+msgid "Uploader callback timeout"
+msgstr "Tempo expirado para callback de quem envia"
+
+#: lib/pleroma/web/uploader_controller.ex:23
+#, elixir-format
+msgid "bad request"
+msgstr "pedido inválido"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:103
+#, elixir-format
+msgid "CAPTCHA Error"
+msgstr "Erro de CAPTCHA"
+
+#: lib/pleroma/web/common_api/common_api.ex:290
+#, elixir-format
+msgid "Could not add reaction emoji"
+msgstr "Não foi possível adicionar reação"
+
+#: lib/pleroma/web/common_api/common_api.ex:301
+#, elixir-format
+msgid "Could not remove reaction emoji"
+msgstr "Não foi possível remover reação"
+
+#: lib/pleroma/web/twitter_api/twitter_api.ex:129
+#, elixir-format
+msgid "Invalid CAPTCHA (Missing parameter: %{name})"
+msgstr "CAPTCHA inválido (Falta o parâmetro: %{name})"
+
+#: lib/pleroma/web/mastodon_api/controllers/list_controller.ex:92
+#, elixir-format
+msgid "List not found"
+msgstr "Lista não encontrada"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:123
+#, elixir-format
+msgid "Missing parameter: %{name}"
+msgstr "Parâmetro em falta: %{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 "É necessário repor palavra-passe"
+
+#: 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 ""
+"Violação de segurança: a verificação de escopo OAuth não foi nem tratada nem "
+"explicitamente ignorada."
+
+#: lib/pleroma/plugs/ensure_authenticated_plug.ex:28
+#, elixir-format
+msgid "Two-factor authentication enabled, you must use a access token."
+msgstr ""
+"Autenticação de dois fatores ativada, deves utilizar uma token de acesso."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:210
+#, elixir-format
+msgid "Unexpected error occurred while adding file to pack."
+msgstr "Ocorreu um erro inesperado ao adicionar ficheiro ao pack."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:138
+#, elixir-format
+msgid "Unexpected error occurred while creating pack."
+msgstr "Ocorreu um erro inesperado ao criar o pack."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:278
+#, elixir-format
+msgid "Unexpected error occurred while removing file from pack."
+msgstr "Ocorreu um erro inesperado ao remover ficheiro do pack."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:250
+#, elixir-format
+msgid "Unexpected error occurred while updating file in pack."
+msgstr "Ocorreu um erro inesperado a atualizar ficheiro no pack."
+
+#: lib/pleroma/web/pleroma_api/controllers/emoji_pack_controller.ex:179
+#, elixir-format
+msgid "Unexpected error occurred while updating pack metadata."
+msgstr "Ocorreu um erro inesperado a atualizar os metadados do pack."
+
+#: lib/pleroma/web/mastodon_api/controllers/subscription_controller.ex:61
+#, elixir-format
+msgid "Web push subscription is disabled on this Pleroma instance"
+msgstr ""
+"Subscrição de notificações push no browser está desativada nesta instância "
+"do 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 "Não podes revogar o teu próprio estatuto de admin/moderador."
+
+#: lib/pleroma/web/mastodon_api/controllers/timeline_controller.ex:126
+#, elixir-format
+msgid "authorization required for timeline view"
+msgstr "autorização necessária para visualizar cronologia"
+
+#: lib/pleroma/web/mastodon_api/controllers/fallback_controller.ex:24
+#, elixir-format
+msgid "Access denied"
+msgstr "Acesso negado"
+
+#: lib/pleroma/web/mastodon_api/controllers/account_controller.ex:282
+#, elixir-format
+msgid "This API requires an authenticated user"
+msgstr "Esta API requer um utilizador autenticado"
+
+#: lib/pleroma/plugs/user_is_admin_plug.ex:21
+#, elixir-format
+msgid "User is not an admin."
+msgstr "Utilizador não é um admin."
index 2f201bd05e96d244690a81f93e4351bae73c8847..5214d59cb968dd5658a9094401e4449bbb26b9b4 100644 (file)
@@ -1,6 +1,9 @@
 defmodule Pleroma.Repo.Migrations.AddObanJobsTable do
   use Ecto.Migration
 
-  defdelegate up, to: Oban.Migrations
+  def up do
+    Oban.Migrations.up(version: 2)
+  end
+
   defdelegate down, to: Oban.Migrations
 end
index 157dc54f997173f477611b431d2e5f8e823b8f94..f673675de45e135ecbb0dc87441e6dd822c891af 100644 (file)
@@ -6,6 +6,6 @@ defmodule Pleroma.Repo.Migrations.UpdateOban do
   end
 
   def down do
-    Oban.Migrations.down(version: 2)
+    Oban.Migrations.down(version: 3)
   end
 end
index e7ff04008c7780fbbcd6e66c9216c025d0b19c3e..ca6856798f9c2f7eac4ade0a562a641184b085ff 100644 (file)
@@ -6,6 +6,6 @@ defmodule Pleroma.Repo.Migrations.UpdateObanJobsTable do
   end
 
   def down do
-    Oban.Migrations.down(version: 7)
+    Oban.Migrations.down(version: 8)
   end
 end
index a703af83fd270064001df1554bb45153dc35d96b..096ab4ce5c7ed58ba837e234fefbf8eae69cb08e 100644 (file)
@@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
   def change do
     Pleroma.Config.Oban.warn()
 
+    Application.ensure_all_started(:oban)
+
     Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
       strategy: :one_for_one,
       name: Pleroma.Supervisor
index 9e49ddacbb7fdc6802dc873229cdff1499f8aeeb..725c5ab0b1cd6d2a7baad2369bff07ad2c4c8261 100644 (file)
@@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
   def change do
     Pleroma.Config.Oban.warn()
 
+    Application.ensure_all_started(:oban)
+
     Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
       strategy: :one_for_one,
       name: Pleroma.Supervisor
diff --git a/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs b/priv/repo/migrations/20210113225652_deprecate_public_endpoint.exs
new file mode 100644 (file)
index 0000000..6f470a4
--- /dev/null
@@ -0,0 +1,57 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpoint do
+  use Ecto.Migration
+
+  def up do
+    with %Pleroma.ConfigDB{} = s3_config <-
+           Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}),
+         %Pleroma.ConfigDB{} = upload_config <-
+           Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) do
+      public_endpoint = s3_config.value[:public_endpoint]
+
+      if !is_nil(public_endpoint) do
+        upload_value = upload_config.value |> Keyword.merge(base_url: public_endpoint)
+
+        upload_config
+        |> Ecto.Changeset.change(value: upload_value)
+        |> Pleroma.Repo.update()
+
+        s3_value = s3_config.value |> Keyword.delete(:public_endpoint)
+
+        s3_config
+        |> Ecto.Changeset.change(value: s3_value)
+        |> Pleroma.Repo.update()
+      end
+    else
+      _ -> :ok
+    end
+  end
+
+  def down do
+    with %Pleroma.ConfigDB{} = upload_config <-
+           Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}),
+         %Pleroma.ConfigDB{} = s3_config <-
+           Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}) do
+      base_url = upload_config.value[:base_url]
+
+      if !is_nil(base_url) do
+        s3_value = s3_config.value |> Keyword.merge(public_endpoint: base_url)
+
+        s3_config
+        |> Ecto.Changeset.change(value: s3_value)
+        |> Pleroma.Repo.update()
+
+        upload_value = upload_config.value |> Keyword.delete(:base_url)
+
+        upload_config
+        |> Ecto.Changeset.change(value: upload_value)
+        |> Pleroma.Repo.update()
+      end
+    else
+      _ -> :ok
+    end
+  end
+end
diff --git a/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs b/priv/repo/migrations/20210115205649_upgrade_oban_jobs_to_v9.exs
new file mode 100644 (file)
index 0000000..bfb4055
--- /dev/null
@@ -0,0 +1,15 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.UpgradeObanJobsToV9 do
+  use Ecto.Migration
+
+  def up do
+    Oban.Migrations.up(version: 9)
+  end
+
+  def down do
+    Oban.Migrations.down(version: 9)
+  end
+end
index 2f5952ef18891ae57a6a583e7030112924b8ded6..42f496ded4611dc8f0ceaf4e55f32232706bee09 100644 (file)
@@ -49,12 +49,18 @@ config :pleroma, Pleroma.Uploaders.Local, uploads: "<%= uploads_dir %>"
 #   sts: true
 
 # Configure S3 support if desired.
-# The public S3 endpoint is different depending on region and provider,
+# The public S3 endpoint (base_url) is different depending on region and provider,
 # consult your S3 provider's documentation for details on what to use.
 #
+# config :pleroma, Pleroma.Upload,
+#  uploader: Pleroma.Uploaders.S3,
+#  base_url: "https://s3.amazonaws.com"
+#
 # config :pleroma, Pleroma.Uploaders.S3,
 #   bucket: "some-bucket",
-#   public_endpoint: "https://s3.amazonaws.com"
+#   bucket_namespace: "my-namespace",
+#   truncated_namespace: nil,
+#   streaming_enabled: true
 #
 # Configure S3 credentials:
 # config :ex_aws, :s3,
index 7dff935585fd3670df152382f2c44372b78d1f39..37e02fae20eb340c3ba46d83242c1de8908b7493 100644 (file)
@@ -94,6 +94,15 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
            end) =~ "Your config is using old namespace for activity expiration configuration."
   end
 
+  test "check_uploders_s3_public_endpoint/0" do
+    clear_config(Pleroma.Uploaders.S3, public_endpoint: "https://fake.amazonaws.com/bucket/")
+
+    assert capture_log(fn ->
+             DeprecationWarnings.check_uploders_s3_public_endpoint()
+           end) =~
+             "Your config is using the old setting for controlling the URL of media uploaded to your S3 bucket."
+  end
+
   describe "check_gun_pool_options/0" do
     test "await_up_timeout" do
       config = Config.get(:connections_pool)
index 4a8d80fcce8b3e4af1bd5232a8319d1bcdcc3ca5..db7678d5d183ce9ab41079792924fccefc6513b9 100644 (file)
@@ -78,8 +78,8 @@ defmodule Pleroma.ObjectTest do
     setup do: clear_config([:instance, :cleanup_attachments])
 
     test "Disabled via config" do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-      Pleroma.Config.put([:instance, :cleanup_attachments], false)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([:instance, :cleanup_attachments], false)
 
       file = %Plug.Upload{
         content_type: "image/jpeg",
@@ -112,8 +112,8 @@ defmodule Pleroma.ObjectTest do
     end
 
     test "in subdirectories" do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-      Pleroma.Config.put([:instance, :cleanup_attachments], true)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([:instance, :cleanup_attachments], true)
 
       file = %Plug.Upload{
         content_type: "image/jpeg",
@@ -146,9 +146,9 @@ defmodule Pleroma.ObjectTest do
     end
 
     test "with dedupe enabled" do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-      Pleroma.Config.put([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe])
-      Pleroma.Config.put([:instance, :cleanup_attachments], true)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([Pleroma.Upload, :filters], [Pleroma.Upload.Filter.Dedupe])
+      clear_config([:instance, :cleanup_attachments], true)
 
       uploads_dir = Pleroma.Config.get!([Pleroma.Uploaders.Local, :uploads])
 
@@ -184,8 +184,8 @@ defmodule Pleroma.ObjectTest do
     end
 
     test "with objects that have legacy data.url attribute" do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-      Pleroma.Config.put([:instance, :cleanup_attachments], true)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([:instance, :cleanup_attachments], true)
 
       file = %Plug.Upload{
         content_type: "image/jpeg",
@@ -220,9 +220,9 @@ defmodule Pleroma.ObjectTest do
     end
 
     test "With custom base_url" do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
-      Pleroma.Config.put([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/")
-      Pleroma.Config.put([:instance, :cleanup_attachments], true)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([Pleroma.Upload, :base_url], "https://sub.domain.tld/dir/")
+      clear_config([:instance, :cleanup_attachments], true)
 
       file = %Plug.Upload{
         content_type: "image/jpeg",
diff --git a/test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs b/test/pleroma/repo/migrations/deprecate_public_endpoint_test.exs
new file mode 100644 (file)
index 0000000..2ffc1b1
--- /dev/null
@@ -0,0 +1,60 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpointTest do
+  use Pleroma.DataCase
+  import Pleroma.Factory
+  import Pleroma.Tests.Helpers
+  alias Pleroma.ConfigDB
+
+  setup do: clear_config(Pleroma.Upload)
+  setup do: clear_config(Pleroma.Uploaders.S3)
+  setup_all do: require_migration("20210113225652_deprecate_public_endpoint")
+
+  test "up/0 migrates public_endpoint to base_url", %{migration: migration} do
+    s3_values = [
+      public_endpoint: "https://coolhost.com/",
+      bucket: "secret_bucket"
+    ]
+
+    insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values)
+
+    upload_values = [
+      uploader: Pleroma.Uploaders.S3
+    ]
+
+    insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values)
+
+    migration.up()
+
+    assert [bucket: "secret_bucket"] ==
+             ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value
+
+    assert [uploader: Pleroma.Uploaders.S3, base_url: "https://coolhost.com/"] ==
+             ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value
+  end
+
+  test "down/0 reverts base_url to public_endpoint", %{migration: migration} do
+    s3_values = [
+      bucket: "secret_bucket"
+    ]
+
+    insert(:config, group: :pleroma, key: Pleroma.Uploaders.S3, value: s3_values)
+
+    upload_values = [
+      uploader: Pleroma.Uploaders.S3,
+      base_url: "https://coolhost.com/"
+    ]
+
+    insert(:config, group: :pleroma, key: Pleroma.Upload, value: upload_values)
+
+    migration.down()
+
+    assert [bucket: "secret_bucket", public_endpoint: "https://coolhost.com/"] ==
+             ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}).value
+
+    assert [uploader: Pleroma.Uploaders.S3] ==
+             ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}).value
+  end
+end
index b84ddcb8e5bba4679efd2df2075c86c7c9f9b1da..10188d11690d7497fbcc019b9575b52bbfc5afa2 100644 (file)
@@ -4,15 +4,14 @@
 
 defmodule Pleroma.ScheduledActivityTest do
   use Pleroma.DataCase
-  alias Pleroma.DataCase
+
   alias Pleroma.ScheduledActivity
+
   import Pleroma.Factory
 
   setup do: clear_config([ScheduledActivity, :enabled])
 
-  setup context do
-    DataCase.ensure_local_uploader(context)
-  end
+  setup [:ensure_local_uploader]
 
   describe "creation" do
     test "scheduled activities with jobs when ScheduledActivity enabled" do
index 8feb532d3528a02d4cfa9d40d214753a671a2f6a..f1ab82a57441b00ad37ec8e8ffcb23504ece8719 100644 (file)
@@ -133,7 +133,7 @@ defmodule Pleroma.UploadTest do
 
       assert %{"url" => [%{"href" => url}]} = data
 
-      assert String.starts_with?(url, Pleroma.Web.base_url() <> "/media/")
+      assert String.starts_with?(url, Pleroma.Upload.base_url())
     end
 
     test "copies the file to the configured folder with deduping" do
@@ -148,8 +148,8 @@ defmodule Pleroma.UploadTest do
       {:ok, data} = Upload.store(file, filters: [Pleroma.Upload.Filter.Dedupe])
 
       assert List.first(data["url"])["href"] ==
-               Pleroma.Web.base_url() <>
-                 "/media/e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
+               Pleroma.Upload.base_url() <>
+                 "e30397b58d226d6583ab5b8b3c5defb0c682bda5c31ef07a9f57c1c4986e3781.jpg"
     end
 
     test "copies the file to the configured folder without deduping" do
index 9c937d2519faca9eadebd1e4357cb255f41a3dc1..709631a6a347aa94bd83d7d3b02a103d3a473c6d 100644 (file)
@@ -12,14 +12,10 @@ defmodule Pleroma.Uploaders.S3Test do
   import ExUnit.CaptureLog
 
   setup do
-    clear_config(Pleroma.Upload,
-      uploader: Pleroma.Uploaders.S3
-    )
-
-    clear_config(Pleroma.Uploaders.S3,
-      bucket: "test_bucket",
-      public_endpoint: "https://s3.amazonaws.com"
-    )
+    clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+    clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+    clear_config([Pleroma.Uploaders.S3])
+    clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket")
   end
 
   describe "get_file/1" do
@@ -33,10 +29,12 @@ defmodule Pleroma.Uploaders.S3Test do
     test "it returns path without bucket when truncated_namespace set to ''" do
       Config.put([Pleroma.Uploaders.S3],
         bucket: "test_bucket",
-        public_endpoint: "https://s3.amazonaws.com",
+        bucket_namespace: "myaccount",
         truncated_namespace: ""
       )
 
+      Config.put([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+
       assert S3.get_file("test_image.jpg") == {
                :ok,
                {:url, "https://s3.amazonaws.com/test_image.jpg"}
@@ -46,7 +44,6 @@ defmodule Pleroma.Uploaders.S3Test do
     test "it returns path with bucket namespace when namespace is set" do
       Config.put([Pleroma.Uploaders.S3],
         bucket: "test_bucket",
-        public_endpoint: "https://s3.amazonaws.com",
         bucket_namespace: "family"
       )
 
index 7fb4c5fbe9eae59069982b4dcfd6eae44cf1f058..1aab25ba6cd958debc1005174ae49c5469b9427e 100644 (file)
@@ -195,12 +195,8 @@ defmodule Pleroma.User.BackupTest do
 
   describe "it uploads and deletes a backup archive" do
     setup do
-      clear_config(Pleroma.Uploaders.S3,
-        bucket: "test_bucket",
-        public_endpoint: "https://s3.amazonaws.com"
-      )
-
-      clear_config([Pleroma.Upload, :uploader])
+      clear_config([Pleroma.Upload, :base_url], "https://s3.amazonaws.com")
+      clear_config([Pleroma.Uploaders.S3, :bucket], "test_bucket")
 
       user = insert(:user, %{nickname: "cofe", name: "Cofe", ap_id: "http://cofe.io/users/cofe"})
 
@@ -219,7 +215,8 @@ defmodule Pleroma.User.BackupTest do
     end
 
     test "S3", %{path: path, backup: backup} do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.S3)
+      clear_config([Pleroma.Uploaders.S3, :streaming_enabled], false)
 
       with_mock ExAws,
         request: fn
@@ -229,13 +226,10 @@ defmodule Pleroma.User.BackupTest do
         assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path)
         assert {:ok, _backup} = Backup.delete(backup)
       end
-
-      with_mock ExAws, request: fn %{http_method: :delete} -> {:ok, %{status_code: 204}} end do
-      end
     end
 
     test "Local", %{path: path, backup: backup} do
-      Pleroma.Config.put([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
+      clear_config([Pleroma.Upload, :uploader], Pleroma.Uploaders.Local)
 
       assert {:ok, %Pleroma.Upload{}} = Backup.upload(backup, path)
       assert {:ok, _backup} = Backup.delete(backup)
index 617d9b755fff0b8b6eb734382d31a3dc37c68101..7e1e75404f9c7213ab90c1f8df811b34b5167d38 100644 (file)
@@ -1563,31 +1563,15 @@ defmodule Pleroma.UserTest do
     end
   end
 
-  describe "delete/1 when confirmation is pending" do
-    setup do
-      user = insert(:user, is_confirmed: false)
-      {:ok, user: user}
-    end
+  test "delete/1 when confirmation is pending deletes the user" do
+    clear_config([:instance, :account_activation_required], true)
+    user = insert(:user, is_confirmed: false)
 
-    test "deletes user from database when activation required", %{user: user} do
-      clear_config([:instance, :account_activation_required], true)
-
-      {:ok, job} = User.delete(user)
-      {:ok, _} = ObanHelpers.perform(job)
-
-      refute User.get_cached_by_id(user.id)
-      refute User.get_by_id(user.id)
-    end
-
-    test "deactivates user when activation is not required", %{user: user} do
-      clear_config([:instance, :account_activation_required], false)
-
-      {:ok, job} = User.delete(user)
-      {:ok, _} = ObanHelpers.perform(job)
+    {:ok, job} = User.delete(user)
+    {:ok, _} = ObanHelpers.perform(job)
 
-      assert %{deactivated: true} = User.get_cached_by_id(user.id)
-      assert %{deactivated: true} = User.get_by_id(user.id)
-    end
+    refute User.get_cached_by_id(user.id)
+    refute User.get_by_id(user.id)
   end
 
   test "delete/1 when approval is pending deletes the user" do
@@ -1830,13 +1814,6 @@ defmodule Pleroma.UserTest do
       assert User.visible_for(user, other_user) == :visible
     end
 
-    test "returns true when the account is unconfirmed and confirmation is not required" do
-      user = insert(:user, local: true, is_confirmed: false)
-      other_user = insert(:user, local: true)
-
-      assert User.visible_for(user, other_user) == :visible
-    end
-
     test "returns true when the account is unconfirmed and being viewed by a privileged account (confirmation required)" do
       Pleroma.Config.put([:instance, :account_activation_required], true)
 
index e3f45ecdb62d2f21575d9a4dda3c49d34cad25b5..13167f50a8405e1598eca733957f07b3f310caa5 100644 (file)
@@ -165,14 +165,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffectsTest do
       {:ok, delete: delete_user, user: user}
     end
 
-    test "when activation is not required", %{delete: delete, user: user} do
-      clear_config([:instance, :account_activation_required], false)
-      {:ok, _, _} = SideEffects.handle(delete)
-      ObanHelpers.perform_all()
-
-      assert User.get_cached_by_id(user.id).deactivated
-    end
-
     test "when activation is required", %{delete: delete, user: user} do
       clear_config([:instance, :account_activation_required], true)
       {:ok, _, _} = SideEffects.handle(delete)
index c309d2f41c08dcbb4478f54f1292e04f8fda1ecd..0ee2aa4a23204da337cef9d7e6ce9a573e11ff96 100644 (file)
@@ -18,6 +18,8 @@ defmodule Pleroma.DataCase do
 
   use ExUnit.CaseTemplate
 
+  import Pleroma.Tests.Helpers, only: [clear_config: 2]
+
   using do
     quote do
       alias Pleroma.Repo
@@ -116,17 +118,10 @@ defmodule Pleroma.DataCase do
   end
 
   def ensure_local_uploader(context) do
-    test_uploader = Map.get(context, :uploader, Pleroma.Uploaders.Local)
-    uploader = Pleroma.Config.get([Pleroma.Upload, :uploader])
-    filters = Pleroma.Config.get([Pleroma.Upload, :filters])
-
-    Pleroma.Config.put([Pleroma.Upload, :uploader], test_uploader)
-    Pleroma.Config.put([Pleroma.Upload, :filters], [])
+    test_uploader = Map.get(context, :uploader) || Pleroma.Uploaders.Local
 
-    on_exit(fn ->
-      Pleroma.Config.put([Pleroma.Upload, :uploader], uploader)
-      Pleroma.Config.put([Pleroma.Upload, :filters], filters)
-    end)
+    clear_config([Pleroma.Upload, :uploader], test_uploader)
+    clear_config([Pleroma.Upload, :filters], [])
 
     :ok
   end
index 4353d5254b84f78f76254d34a0bae849eccdad48..856a6a376f8865fa08be93448402adebd940f28c 100644 (file)
@@ -8,6 +8,8 @@ defmodule Pleroma.Tests.Helpers do
   """
   alias Pleroma.Config
 
+  require Logger
+
   defmacro clear_config(config_path) do
     quote do
       clear_config(unquote(config_path)) do
@@ -18,6 +20,7 @@ defmodule Pleroma.Tests.Helpers do
   defmacro clear_config(config_path, do: yield) do
     quote do
       initial_setting = Config.fetch(unquote(config_path))
+
       unquote(yield)
 
       on_exit(fn ->
@@ -35,6 +38,15 @@ defmodule Pleroma.Tests.Helpers do
   end
 
   defmacro clear_config(config_path, temp_setting) do
+    # NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!)
+    # Displaying a warning to prevent unintentional clearing of all but one keys in section
+    if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do
+      Logger.warn(
+        "Please change to `clear_config([section]); clear_config([section, key], value)`: " <>
+          "#{inspect(config_path)}, #{inspect(temp_setting)}"
+      )
+    end
+
     quote do
       clear_config(unquote(config_path)) do
         Config.put(unquote(config_path), unquote(temp_setting))