### Changed
+- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
+- **Breaking**: AdminAPI changed User field `confirmation_pending` to `is_confirmed`
+- **Breaking**: AdminAPI changed User field `approval_pending` to `is_approved`
- Polls now always return a `voters_count`, even if they are single-choice.
- Admin Emails: The ap id is used as the user link in emails now.
- Improved registration workflow for email confirmation and account approval modes.
-- **Breaking:** Changed `mix pleroma.user toggle_confirmed` to `mix pleroma.user confirm`
- 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
- Mastodon API: User and conversation mutes can now auto-expire if `expires_in` parameter was given while adding the mute.
- Admin API: An endpoint to manage frontends.
- Streaming API: Add follow relationships updates.
+- WebPush: Introduce `pleroma:chat_mention` and `pleroma:emoji_reaction` notification types
</details>
### Fixed
- 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>
## Unreleased (Patch)
+
+## [2.2.2] - 2020-01-18
+
### Fixed
-- Fix ability to update Pleroma Chat push notifications with PUT /api/v1/push/subscription and alert type pleroma:chat_mention
-- Emoji Reaction activity filtering from blocked and muted accounts.
- 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
- Rich Media Previews sometimes showed the wrong preview due to a bug following redirects.
- Fixes for the autolinker.
- Forwarded reports duplication from Pleroma instances.
+- Emoji Reaction activity filtering from blocked and muted accounts.
- <details>
<summary>API</summary>
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"],
scheduled_activities: 10,
background: 5,
remote_fetcher: 2,
- attachments_cleanup: 5,
+ attachments_cleanup: 1,
new_users_digest: 1,
mute_expire: 5
],
config :pleroma, :dangerzone, override_repo_pool_size: true
# Reduce hash rounds for testing
-config :pbkdf2_elixir, rounds: 1
+config :pleroma, :password, iterations: 1
config :tesla, adapter: Tesla.Mock
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: []
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
_ ->
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
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
""
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
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 ->
end
_ ->
- public_endpoint || upload_base_url
+ public_endpoint || upload_base_url || Pleroma.Web.base_url() <> "/media/"
end
end
end
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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)
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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",
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",
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])
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",
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",
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
{: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
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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
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"}
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"
)
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
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"})
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
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)
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.DataCase do
use ExUnit.CaseTemplate
+ import Pleroma.Tests.Helpers, only: [clear_config: 2]
+
using do
quote do
alias Pleroma.Repo
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
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Tests.Helpers do
"""
alias Pleroma.Config
+ require Logger
+
defmacro clear_config(config_path) do
quote do
clear_config(unquote(config_path)) do
defmacro clear_config(config_path, do: yield) do
quote do
initial_setting = Config.fetch(unquote(config_path))
+
unquote(yield)
on_exit(fn ->
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))