Merge remote-tracking branch 'upstream/develop' into neckbeard
This commit is contained in:
commit
c465d60bd0
|
@ -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
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Quack, the logging backend that pushes to Slack channels
|
- Quack, the logging backend that pushes to Slack channels
|
||||||
|
|
|
@ -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, _} ->
|
||||||
|
|
|
@ -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}
|
||||||
|
|
|
@ -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()}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue