Merge branch 'develop' into 'akoma/deactivated-users'

# Conflicts:
#   CHANGELOG.md
This commit is contained in:
feld 2022-11-14 14:03:11 +00:00
commit a9d991d31e
11 changed files with 6345 additions and 15 deletions

View File

@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- **Breaking**: `/api/v1/pleroma/backups` endpoints now requires `read:backups` scope instead of `read:accounts` - **Breaking**: `/api/v1/pleroma/backups` endpoints now requires `read:backups` scope instead of `read:accounts`
- Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+ - Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+
- Set timeout values for Oban queues. The default is infinity and some operations may not time out on their own. - Set timeout values for Oban queues. The default is infinity and some operations may not time out on their own.
- Delete activities are federated at lowest priority
### Added ### Added
- `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object - `activeMonth` and `activeHalfyear` fields in NodeInfo usage.users object
@ -55,6 +56,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fixed slow timelines when there are a lot of deactivated users - Fixed slow timelines when there are a lot of deactivated users
- Fixed account deletion API - Fixed account deletion API
- Fixed lowercase HTTP HEAD method in the Media Proxy Preview code - Fixed lowercase HTTP HEAD method in the Media Proxy Preview code
- Removed useless notification call on Delete activities
- Improved performance for filtering out deactivated and invisible users - Improved performance for filtering out deactivated and invisible users
### Removed ### Removed

View File

@ -4,6 +4,7 @@
defmodule Pleroma.Object.Fetcher do defmodule Pleroma.Object.Fetcher do
alias Pleroma.HTTP alias Pleroma.HTTP
alias Pleroma.Instances
alias Pleroma.Maps alias Pleroma.Maps
alias Pleroma.Object alias Pleroma.Object
alias Pleroma.Object.Containment alias Pleroma.Object.Containment
@ -234,6 +235,10 @@ defmodule Pleroma.Object.Fetcher do
{:ok, body} <- get_object(id), {:ok, body} <- get_object(id),
{:ok, data} <- safe_json_decode(body), {:ok, data} <- safe_json_decode(body),
:ok <- Containment.contain_origin_from_id(id, data) do :ok <- Containment.contain_origin_from_id(id, data) do
if not Instances.reachable?(id) do
Instances.set_reachable(id)
end
{:ok, data} {:ok, data}
else else
{:scheme, _} -> {:scheme, _} ->

View File

@ -282,7 +282,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
# Tasks this handles: # Tasks this handles:
# - Delete and unpins the create activity # - Delete and unpins the create activity
# - Replace object with Tombstone # - Replace object with Tombstone
# - Set up notification
# - Reduce the user note count # - Reduce the user note count
# - Reduce the reply count # - Reduce the reply count
# - Stream out the activity # - Stream out the activity
@ -324,7 +323,6 @@ defmodule Pleroma.Web.ActivityPub.SideEffects do
end end
if result == :ok do if result == :ok do
Notification.create_notifications(object)
{:ok, object, meta} {:ok, object, meta}
else else
{:error, result} {:error, result}

View File

@ -47,10 +47,15 @@ defmodule Pleroma.Web.Federator do
end end
@impl true @impl true
def publish(activity) do def publish(%Pleroma.Activity{data: %{"type" => type}} = activity) do
PublisherWorker.enqueue("publish", %{"activity_id" => activity.id}) PublisherWorker.enqueue("publish", %{"activity_id" => activity.id},
priority: publish_priority(type)
)
end end
defp publish_priority("Delete"), do: 3
defp publish_priority(_), do: 0
# Job Worker Callbacks # Job Worker Callbacks
@spec perform(atom(), module(), any()) :: {:ok, any()} | {:error, any()} @spec perform(atom(), module(), any()) :: {:ok, any()} | {:error, any()}

View File

@ -68,7 +68,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
] ]
} }
[{"reply-to", Jason.encode!(report_group)} | headers] [{"report-to", Jason.encode!(report_group)} | headers]
else else
headers headers
end end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,197 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-18 19:11+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Translate Toolkit 3.7.2\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.
#: lib/pleroma/web/api_spec/render_error.ex:122
#, elixir-autogen, elixir-format
msgid "%{name} - %{count} is not a multiple of %{multiple}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:131
#, elixir-autogen, elixir-format
msgid "%{name} - %{value} is larger than exclusive maximum %{max}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:140
#, elixir-autogen, elixir-format
msgid "%{name} - %{value} is larger than inclusive maximum %{max}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:149
#, elixir-autogen, elixir-format
msgid "%{name} - %{value} is smaller than exclusive minimum %{min}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:158
#, elixir-autogen, elixir-format
msgid "%{name} - %{value} is smaller than inclusive minimum %{min}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:102
#, elixir-autogen, elixir-format
msgid "%{name} - Array items must be unique."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:114
#, elixir-autogen, elixir-format
msgid "%{name} - Array length %{length} is larger than maxItems: %{}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:106
#, elixir-autogen, elixir-format
msgid "%{name} - Array length %{length} is smaller than minItems: %{min}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:166
#, elixir-autogen, elixir-format
msgid "%{name} - Invalid %{type}. Got: %{value}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:174
#, elixir-autogen, elixir-format
msgid "%{name} - Invalid format. Expected %{format}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:51
#, elixir-autogen, elixir-format
msgid "%{name} - Invalid schema.type. Got: %{type}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:178
#, elixir-autogen, elixir-format
msgid "%{name} - Invalid value for enum."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:95
#, elixir-autogen, elixir-format
msgid "%{name} - String length is larger than maxLength: %{length}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:88
#, elixir-autogen, elixir-format
msgid "%{name} - String length is smaller than minLength: %{length}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:63
#, elixir-autogen, elixir-format
msgid "%{name} - null value where %{type} expected."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:60
#, elixir-autogen, elixir-format
msgid "%{name} - null value."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:182
#, elixir-autogen, elixir-format
msgid "Failed to cast to any schema in %{polymorphic_type}"
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:71
#, elixir-autogen, elixir-format
msgid "Failed to cast value as %{invalid_schema}. Value must be castable using `allOf` schemas listed."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:84
#, elixir-autogen, elixir-format
msgid "Failed to cast value to one of: %{failed_schemas}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:78
#, elixir-autogen, elixir-format
msgid "Failed to cast value using any of: %{failed_schemas}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:212
#, elixir-autogen, elixir-format
msgid "Invalid value for header: %{name}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:204
#, elixir-autogen, elixir-format
msgid "Missing field: %{name}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:208
#, elixir-autogen, elixir-format
msgid "Missing header: %{name}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:196
#, elixir-autogen, elixir-format
msgid "No value provided for required discriminator `%{field}`."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:216
#, elixir-autogen, elixir-format
msgid "Object property count %{property_count} is greater than maxProperties: %{max_properties}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:224
#, elixir-autogen, elixir-format
msgid "Object property count %{property_count} is less than minProperties: %{min_properties}"
msgstr ""
#: lib/pleroma/web/templates/static_fe/static_fe/error.html.eex:2
#, elixir-autogen, elixir-format
msgid "Oops"
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:188
#, elixir-autogen, elixir-format
msgid "Unexpected field: %{name}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:200
#, elixir-autogen, elixir-format
msgid "Unknown schema: %{name}."
msgstr ""
#: lib/pleroma/web/api_spec/render_error.ex:192
#, elixir-autogen, elixir-format
msgid "Value used as discriminator for `%{field}` matches no schemas."
msgstr ""
#: lib/pleroma/web/templates/embed/show.html.eex:43
#: lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex:37
#, elixir-autogen, elixir-format
msgid "announces"
msgstr ""
#: lib/pleroma/web/templates/embed/show.html.eex:44
#: lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex:38
#, elixir-autogen, elixir-format
msgid "likes"
msgstr ""
#: lib/pleroma/web/templates/embed/show.html.eex:42
#: lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex:36
#, elixir-autogen, elixir-format
msgid "replies"
msgstr ""
#: lib/pleroma/web/templates/embed/show.html.eex:27
#: lib/pleroma/web/templates/static_fe/static_fe/_notice.html.eex:22
#, elixir-autogen, elixir-format
msgid "sensitive media"
msgstr ""

View File

@ -3,17 +3,17 @@ msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-12-10 16:09+0000\n" "POT-Creation-Date: 2020-12-10 16:09+0000\n"
"PO-Revision-Date: 2020-12-11 00:56+0000\n" "PO-Revision-Date: 2022-09-18 17:09+0000\n"
"Last-Translator: ZEN <xinit.info@gmail.com>\n" "Last-Translator: Dmytro Poltavchenko <xinit.info@gmail.com>\n"
"Language-Team: Ukrainian <https://translate.pleroma.social/projects/pleroma/" "Language-Team: Ukrainian <http://weblate.pleroma-dev.ebin.club/projects/"
"pleroma/uk/>\n" "pleroma/pleroma-backend-domain-errors/uk/>\n"
"Language: uk\n" "Language: uk\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=" "Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 4.0.4\n" "X-Generator: Weblate 4.13.1\n"
## This file is a PO Template file. ## This file is a PO Template file.
## ##
@ -312,7 +312,7 @@ msgstr "Цей ресурс вимагає автентифікації."
#: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206 #: lib/pleroma/plugs/rate_limiter/rate_limiter.ex:206
#, elixir-format #, elixir-format
msgid "Throttled" msgid "Throttled"
msgstr "Обмежено. Перевищено ліміт запитів." msgstr "Перевищено ліміт запитів"
#: lib/pleroma/web/common_api/common_api.ex:356 #: lib/pleroma/web/common_api/common_api.ex:356
#, elixir-format #, elixir-format

View File

@ -6,6 +6,7 @@ defmodule Pleroma.Object.FetcherTest do
use Pleroma.DataCase use Pleroma.DataCase
alias Pleroma.Activity alias Pleroma.Activity
alias Pleroma.Instances
alias Pleroma.Object alias Pleroma.Object
alias Pleroma.Object.Fetcher alias Pleroma.Object.Fetcher
@ -159,6 +160,17 @@ defmodule Pleroma.Object.FetcherTest do
"https://patch.cx/media/03ca3c8b4ac3ddd08bf0f84be7885f2f88de0f709112131a22d83650819e36c2.json" "https://patch.cx/media/03ca3c8b4ac3ddd08bf0f84be7885f2f88de0f709112131a22d83650819e36c2.json"
) )
end end
test "it resets instance reachability on successful fetch" do
id = "http://mastodon.example.org/@admin/99541947525187367"
Instances.set_consistently_unreachable(id)
refute Instances.reachable?(id)
{:ok, object} =
Fetcher.fetch_object_from_id("http://mastodon.example.org/@admin/99541947525187367")
assert Instances.reachable?(id)
end
end end
describe "implementation quirks" do describe "implementation quirks" do

View File

@ -59,9 +59,9 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlugTest do
assert csp =~ ~r|report-uri https://endpoint.com;report-to csp-endpoint;| assert csp =~ ~r|report-uri https://endpoint.com;report-to csp-endpoint;|
[reply_to] = Conn.get_resp_header(conn, "reply-to") [report_to] = Conn.get_resp_header(conn, "report-to")
assert reply_to == assert report_to ==
"{\"endpoints\":[{\"url\":\"https://endpoint.com\"}],\"group\":\"csp-endpoint\",\"max-age\":10886400}" "{\"endpoints\":[{\"url\":\"https://endpoint.com\"}],\"group\":\"csp-endpoint\",\"max-age\":10886400}"
end end

View File

@ -0,0 +1,40 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Workers.PublisherWorkerTest do
use Pleroma.DataCase, async: true
use Oban.Testing, repo: Pleroma.Repo
import Pleroma.Factory
alias Pleroma.Object
alias Pleroma.Web.ActivityPub.ActivityPub
alias Pleroma.Web.ActivityPub.Builder
alias Pleroma.Web.CommonAPI
alias Pleroma.Web.Federator
describe "Oban job priority:" do
setup do
user = insert(:user)
{:ok, post} = CommonAPI.post(user, %{status: "Regrettable post"})
object = Object.normalize(post, fetch: false)
{:ok, delete_data, _meta} = Builder.delete(user, object.data["id"])
{:ok, delete, _meta} = ActivityPub.persist(delete_data, local: true)
%{
post: post,
delete: delete
}
end
test "Deletions are lower priority", %{delete: delete} do
assert {:ok, %Oban.Job{priority: 3}} = Federator.publish(delete)
end
test "Creates are normal priority", %{post: post} do
assert {:ok, %Oban.Job{priority: 0}} = Federator.publish(post)
end
end
end