Merge branch 'develop' into 'fix/rename-no_attachment_links-setting'
authorfeld <feld@feld.me>
Thu, 13 Feb 2020 14:37:55 +0000 (14:37 +0000)
committerfeld <feld@feld.me>
Thu, 13 Feb 2020 14:37:55 +0000 (14:37 +0000)
# Conflicts:
#   config/description.exs

CHANGELOG.md
config/config.exs
config/description.exs
lib/pleroma/web/common_api/utils.ex
test/tasks/config_test.exs
test/web/common_api/common_api_utils_test.exs

index 150fd27cdfc178963b6494286c9673cca2f6e793..3e838983b4b4393e26f0ae8ae27a90e685c7acbb 100644 (file)
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 - **Breaking:** attachment links (`config :pleroma, :instance, no_attachment_links` and `config :pleroma, Pleroma.Upload, link_name`) disabled by default
 - **Breaking:** OAuth: defaulted `[:auth, :enforce_oauth_admin_scope_usage]` setting to `true` which demands `admin` OAuth scope to perform admin actions (in addition to `is_admin` flag on User); make sure to use bundled or newer versions of AdminFE & PleromaFE to access admin / moderator features.
 - **Breaking:** Dynamic configuration has been rearchitected. The `:pleroma, :instance, dynamic_configuration` setting has been replaced with `config :pleroma, configurable_from_database`. Please backup your configuration to a file and run the migration task to ensure consistency with the new schema.
+- **Breaking:** `:instance, no_attachment_links` has been replaced with `:instance, attachment_links` which still takes a boolean value but doesn't use double negative language.
 - Replaced [pleroma_job_queue](https://git.pleroma.social/pleroma/pleroma_job_queue) and `Pleroma.Web.Federator.RetryQueue` with [Oban](https://github.com/sorentwo/oban) (see [`docs/config.md`](docs/config.md) on migrating customized worker / retry settings)
 - Introduced [quantum](https://github.com/quantum-elixir/quantum-core) job scheduler
 - Enabled `:instance, extended_nickname_format` in the default config
index 41c1ff6371a21e56af6a4fdaf45aaf79801096c1..ccc0c4e525b99b79a08a2c64e8fd6761ac8ff59f 100644 (file)
@@ -241,7 +241,7 @@ config :pleroma, :instance,
   mrf_transparency_exclusions: [],
   autofollowed_nicknames: [],
   max_pinned_statuses: 1,
-  no_attachment_links: true,
+  attachment_links: false,
   welcome_user_nickname: nil,
   welcome_message: nil,
   max_report_comment_size: 1000,
index 661acd7167b224a586fcf1424f2675dd868a714c..efea7c137728dd2cbf2a1d7674ce97792ded7a4b 100644 (file)
@@ -798,9 +798,9 @@ config :pleroma, :config_description, [
         ]
       },
       %{
-        key: :no_attachment_links,
+        key: :attachment_links,
         type: :boolean,
-        description: "Enable to disable automatically adding attachment link text to statuses"
+        description: "Enable to automatically add attachment link text to statuses"
       },
       %{
         key: :welcome_message,
index ca6c9386276178b0eb68fa6eaafc3453c7067270..4445894b0d82337bbdace5cacc3b17b5fd94a7c3 100644 (file)
@@ -228,9 +228,9 @@ defmodule Pleroma.Web.CommonAPI.Utils do
         data,
         visibility
       ) do
-    no_attachment_links =
+    attachment_links =
       data
-      |> Map.get("no_attachment_links", Config.get([:instance, :no_attachment_links]))
+      |> Map.get("attachment_links", Config.get([:instance, :attachment_links]))
       |> truthy_param?()
 
     content_type = get_content_type(data["content_type"])
@@ -244,7 +244,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
 
     status
     |> format_input(content_type, options)
-    |> maybe_add_attachments(attachments, no_attachment_links)
+    |> maybe_add_attachments(attachments, attachment_links)
     |> maybe_add_nsfw_tag(data)
   end
 
@@ -270,7 +270,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
   def make_context(%Activity{data: %{"context" => context}}, _), do: context
   def make_context(_, _), do: Utils.generate_context_id()
 
-  def maybe_add_attachments(parsed, _attachments, true = _no_links), do: parsed
+  def maybe_add_attachments(parsed, _attachments, false = _no_links), do: parsed
 
   def maybe_add_attachments({text, mentions, tags}, attachments, _no_links) do
     text = add_attachments(text, attachments)
index d79d34276db85673d0da3b951f20a1faddbd663a..2f9405550be5a30a799661fb77a96e8f6b9a389e 100644 (file)
@@ -145,7 +145,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
           mrf_transparency_exclusions: [],
           autofollowed_nicknames: [],
           max_pinned_statuses: 1,
-          no_attachment_links: true,
+          attachment_links: false,
           welcome_user_nickname: nil,
           welcome_message: nil,
           max_report_comment_size: 1000,
@@ -190,7 +190,7 @@ defmodule Mix.Tasks.Pleroma.ConfigTest do
         end
 
       assert file ==
-               "#{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  rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,\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  mrf_transparency: true,\n  mrf_transparency_exclusions: [],\n  autofollowed_nicknames: [],\n  max_pinned_statuses: 1,\n  no_attachment_links: true,\n  welcome_user_nickname: nil,\n  welcome_message: nil,\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"
+               "#{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  rewrite_policy: Pleroma.Web.ActivityPub.MRF.NoOpPolicy,\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  mrf_transparency: true,\n  mrf_transparency_exclusions: [],\n  autofollowed_nicknames: [],\n  max_pinned_statuses: 1,\n  attachment_links: false,\n  welcome_user_nickname: nil,\n  welcome_message: nil,\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
 end
index 4b761e0395aef71b52f0ee1c717b1745c99fdc22..848300ef37a2052ea0636105ca501f028b0bbd28 100644 (file)
@@ -575,11 +575,11 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
   end
 
   describe "maybe_add_attachments/3" do
-    test "returns parsed results when no_links is true" do
+    test "returns parsed results when attachment_links is false" do
       assert Utils.maybe_add_attachments(
                {"test", [], ["tags"]},
                [],
-               true
+               false
              ) == {"test", [], ["tags"]}
     end
 
@@ -589,7 +589,7 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
       assert Utils.maybe_add_attachments(
                {"test", [], ["tags"]},
                [attachment],
-               false
+               true
              ) == {
                "test<br><a href=\"SakuraPM.png\" class='attachment'>SakuraPM.png</a>",
                [],