From df25d86999cd4037e13cc2753b488016a0dd0bfb Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Fri, 12 Apr 2024 18:50:57 +0100 Subject: [PATCH 1/2] Cleaned up FEP-fffd commits a bit --- CHANGELOG.md | 3 ++- .../article_note_page_validator.ex | 9 ++++----- .../article_note_page_validator_test.exs | 13 ++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 699aa30e2..5dac6950d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased ## Added - +- Support for [FEP-fffd](https://codeberg.org/fediverse/fep/src/branch/main/fep/fffd/fep-fffd.md) (proxy objects) + ## Changed ## Fixed diff --git a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex index ed1b90eab..d1cd496db 100644 --- a/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validators/article_note_page_validator.ex @@ -53,12 +53,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do defp fix_url(%{"url" => url} = data) when is_bitstring(url), do: data defp fix_url(%{"url" => url} = data) when is_map(url), do: Map.put(data, "url", url["href"]) + defp fix_url(%{"url" => url} = data) when is_list(url) do - if is_map(List.first(url)) do - Map.put(data, "url", List.first(url)["href"]) - else - Map.put(data, "url", List.first(url)) - end + data + |> Map.put("url", List.first(url)) + |> fix_url() end defp fix_url(data), do: data diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs index 1aaf9a566..4e96f3200 100644 --- a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs @@ -50,14 +50,17 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest end test "note with url array validates if contains a link object", %{note: note} do - note = Map.put(note, "url", [%{ - "type" => "Link", - "href" => "https://remote.example/link" - }]) + note = + Map.put(note, "url", [ + %{ + "type" => "Link", + "href" => "https://remote.example/link" + } + ]) + %{valid?: true} = ArticleNotePageValidator.cast_and_validate(note) end - test "a note with a language validates" do insert(:user, %{ap_id: "https://mastodon.social/users/akkoma_ap_integration_tester"}) note = File.read!("test/fixtures/mastodon/note_with_language.json") |> Jason.decode!() From d910e8d7d135a259b56b605491f572f93868f9d8 Mon Sep 17 00:00:00 2001 From: Floatingghost Date: Fri, 12 Apr 2024 19:13:33 +0100 Subject: [PATCH 2/2] Add test suite for elixir1.16 --- .woodpecker/test.yml | 3 +++ CHANGELOG.md | 3 ++- docs/docs/installation/generic_dependencies.include | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.woodpecker/test.yml b/.woodpecker/test.yml index 16a4067fe..c8b819ce8 100644 --- a/.woodpecker/test.yml +++ b/.woodpecker/test.yml @@ -7,6 +7,7 @@ matrix: ELIXIR_VERSION: - 1.14 - 1.15 + - 1.16 OTP_VERSION: - 25 - 26 @@ -17,6 +18,8 @@ matrix: OTP_VERSION: 25 - ELIXIR_VERSION: 1.15 OTP_VERSION: 26 + - ELIXIR_VERSION: 1.16 + OTP_VERSION: 26 variables: - &scw-secrets diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dac6950d..e397a75d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Added - Support for [FEP-fffd](https://codeberg.org/fediverse/fep/src/branch/main/fep/fffd/fep-fffd.md) (proxy objects) - +- Verified support for elixir 1.16 + ## Changed ## Fixed diff --git a/docs/docs/installation/generic_dependencies.include b/docs/docs/installation/generic_dependencies.include index b23736d85..d7701a28f 100644 --- a/docs/docs/installation/generic_dependencies.include +++ b/docs/docs/installation/generic_dependencies.include @@ -1,8 +1,8 @@ ## Required dependencies * PostgreSQL 9.6+ -* Elixir 1.14+ -* Erlang OTP 25+ +* Elixir 1.14+ (currently tested up to 1.16) +* Erlang OTP 25+ (currently tested up to OTP26) * git * file / libmagic * gcc (clang might also work)