Merge branch 'develop' into issue/1276
This commit is contained in:
commit
6f9839c73c
|
@ -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
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
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,
|
||||
|
|
|
@ -637,22 +637,24 @@
|
|||
%{
|
||||
key: :registrations_open,
|
||||
type: :boolean,
|
||||
description: "Enable registrations for anyone, invitations can be enabled when `false`"
|
||||
description:
|
||||
"Enable registrations for anyone. Invitations require this setting to be disabled."
|
||||
},
|
||||
%{
|
||||
key: :invites_enabled,
|
||||
type: :boolean,
|
||||
description: "Enable user invitations for admins (depends on `registrations_open: false`)"
|
||||
description:
|
||||
"Enable user invitations for admins (depends on `registrations_open` being disabled)."
|
||||
},
|
||||
%{
|
||||
key: :account_activation_required,
|
||||
type: :boolean,
|
||||
description: "Require users to confirm their emails before signing in"
|
||||
description: "Require users to confirm their emails before signing in."
|
||||
},
|
||||
%{
|
||||
key: :federating,
|
||||
type: :boolean,
|
||||
description: "Enable federation with other instances"
|
||||
description: "Enable federation with other instances."
|
||||
},
|
||||
%{
|
||||
key: :federation_incoming_replies_max_depth,
|
||||
|
@ -761,14 +763,14 @@
|
|||
key: :extended_nickname_format,
|
||||
type: :boolean,
|
||||
description:
|
||||
"Set to `true` to use extended local nicknames format (allows underscores/dashes)." <>
|
||||
"Enable to use extended local nicknames format (allows underscores/dashes)." <>
|
||||
" This will break federation with older software for theses nicknames."
|
||||
},
|
||||
%{
|
||||
key: :cleanup_attachments,
|
||||
type: :boolean,
|
||||
description: """
|
||||
"Set to `true` to remove associated attachments when status is removed.
|
||||
"Enable to remove associated attachments when status is removed.
|
||||
This will not affect duplicates and attachments without status.
|
||||
Enabling this will increase load to database when deleting statuses on larger instances.
|
||||
"""
|
||||
|
@ -796,10 +798,9 @@
|
|||
]
|
||||
},
|
||||
%{
|
||||
key: :no_attachment_links,
|
||||
key: :attachment_links,
|
||||
type: :boolean,
|
||||
description:
|
||||
"Set to `true` to disable automatically adding attachment link text to statuses"
|
||||
description: "Enable to automatically add attachment link text to statuses"
|
||||
},
|
||||
%{
|
||||
key: :welcome_message,
|
||||
|
@ -830,14 +831,14 @@
|
|||
key: :safe_dm_mentions,
|
||||
type: :boolean,
|
||||
description:
|
||||
"If set to `true`, only mentions at the beginning of a post will be used to address people in direct messages." <>
|
||||
"If enabled, only mentions at the beginning of a post will be used to address people in direct messages." <>
|
||||
" This is to prevent accidental mentioning of people when talking about them (e.g. \"@admin please keep an eye on @bad_actor\")." <>
|
||||
" Default: `false`"
|
||||
" Default: disabled"
|
||||
},
|
||||
%{
|
||||
key: :healthcheck,
|
||||
type: :boolean,
|
||||
description: "If set to `true`, system data will be shown on /api/pleroma/healthcheck"
|
||||
description: "If enabled, system data will be shown on /api/pleroma/healthcheck"
|
||||
},
|
||||
%{
|
||||
key: :remote_post_retention_days,
|
||||
|
@ -867,7 +868,7 @@
|
|||
%{
|
||||
key: :skip_thread_containment,
|
||||
type: :boolean,
|
||||
description: "Skip filter out broken threads. Default: `true`"
|
||||
description: "Skip filtering out broken threads. Default: enabled"
|
||||
},
|
||||
%{
|
||||
key: :limit_to_local_content,
|
||||
|
@ -1159,17 +1160,15 @@
|
|||
key: :alwaysShowSubjectInput,
|
||||
label: "Always show subject input",
|
||||
type: :boolean,
|
||||
description: "When set to `false`, auto-hide the subject field when it's empty"
|
||||
description: "When disabled, auto-hide the subject field if it's empty"
|
||||
},
|
||||
%{
|
||||
key: :logoMask,
|
||||
label: "Logo mask",
|
||||
type: :boolean,
|
||||
description:
|
||||
"By default it assumes logo used will be monochrome-with-alpha one, this is done to be compatible with both light and dark themes, " <>
|
||||
"so that white logo designed with dark theme in mind won't be invisible over light theme, this is done via CSS3 Masking. " <>
|
||||
"Basically - it will take alpha channel of the image and fill non-transparent areas of it with solid color. " <>
|
||||
"If you really want colorful logo - it can be done by setting logoMask to false."
|
||||
"By default it assumes logo used will be monochrome with alpha channel to be compatible with both light and dark themes. " <>
|
||||
"If you want a colorful logo you must disable logoMask."
|
||||
},
|
||||
%{
|
||||
key: :logoMargin,
|
||||
|
@ -1183,13 +1182,13 @@
|
|||
%{
|
||||
key: :stickers,
|
||||
type: :boolean,
|
||||
description: "Enables/disables stickers."
|
||||
description: "Enables stickers."
|
||||
},
|
||||
%{
|
||||
key: :enableEmojiPicker,
|
||||
label: "Emoji picker",
|
||||
type: :boolean,
|
||||
description: "Enables/disables emoji picker."
|
||||
description: "Enables emoji picker."
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -2086,7 +2085,7 @@
|
|||
key: :unfurl_nsfw,
|
||||
label: "Unfurl NSFW",
|
||||
type: :boolean,
|
||||
description: "If set to `true` NSFW attachments will be shown in previews"
|
||||
description: "When enabled NSFW attachments will be shown in previews"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -2358,7 +2357,7 @@
|
|||
type: :boolean,
|
||||
description:
|
||||
"OAuth admin scope requirement toggle. " <>
|
||||
"If `true`, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token " <>
|
||||
"If enabled, admin actions explicitly demand admin OAuth scope(s) presence in OAuth token " <>
|
||||
"(client app must support admin scopes). If `false` and token doesn't have admin scope(s)," <>
|
||||
"`is_admin` user flag grants access to admin-specific actions."
|
||||
},
|
||||
|
|
|
@ -62,6 +62,6 @@ def validate_scheduled_at(changeset) do
|
|||
def expires_late_enough?(scheduled_at) do
|
||||
now = NaiveDateTime.utc_now()
|
||||
diff = NaiveDateTime.diff(scheduled_at, now, :millisecond)
|
||||
diff >= @min_activity_lifetime
|
||||
diff > @min_activity_lifetime
|
||||
end
|
||||
end
|
||||
|
|
|
@ -228,9 +228,9 @@ def make_content_html(
|
|||
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 @@ def make_content_html(
|
|||
|
||||
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 @@ def make_context(_, %Participation{} = participation) 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)
|
||||
|
|
|
@ -145,7 +145,7 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil
|
|||
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 @@ test "load a settings with large values and pass to file", %{temp_file: temp_fil
|
|||
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
|
||||
|
|
|
@ -575,11 +575,11 @@ test "returns note data" 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 @@ test "adds attachments to parsed results" do
|
|||
assert Utils.maybe_add_attachments(
|
||||
{"test", [], ["tags"]},
|
||||
[attachment],
|
||||
false
|
||||
true
|
||||
) == {
|
||||
"test<br><a href=\"SakuraPM.png\" class='attachment'>SakuraPM.png</a>",
|
||||
[],
|
||||
|
|
|
@ -121,6 +121,32 @@ test "posting a status", %{conn: conn} do
|
|||
NaiveDateTime.to_iso8601(expiration.scheduled_at)
|
||||
end
|
||||
|
||||
test "it fails to create a status if `expires_in` is less or equal than an hour", %{
|
||||
conn: conn
|
||||
} do
|
||||
# 1 hour
|
||||
expires_in = 60 * 60
|
||||
|
||||
assert %{"error" => "Expiry date is too soon"} =
|
||||
conn
|
||||
|> post("api/v1/statuses", %{
|
||||
"status" => "oolong",
|
||||
"expires_in" => expires_in
|
||||
})
|
||||
|> json_response(422)
|
||||
|
||||
# 30 minutes
|
||||
expires_in = 30 * 60
|
||||
|
||||
assert %{"error" => "Expiry date is too soon"} =
|
||||
conn
|
||||
|> post("api/v1/statuses", %{
|
||||
"status" => "oolong",
|
||||
"expires_in" => expires_in
|
||||
})
|
||||
|> json_response(422)
|
||||
end
|
||||
|
||||
test "posting an undefined status with an attachment", %{user: user, conn: conn} do
|
||||
file = %Plug.Upload{
|
||||
content_type: "image/jpg",
|
||||
|
|
Loading…
Reference in a new issue