From c3069b9478b1defd11e33f13527ba14af0024088 Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 19 Jun 2024 01:49:59 +0200 Subject: [PATCH 1/2] cosmetic: fix elixir 1.17 compiler warnings in main application --- lib/pleroma/web/activity_pub/mrf.ex | 2 +- lib/pleroma/web/templates/feed/feed/tag.atom.eex | 4 ++-- lib/pleroma/web/templates/feed/feed/tag.rss.eex | 2 +- lib/pleroma/web/templates/feed/feed/user.atom.eex | 4 ++-- lib/pleroma/web/templates/feed/feed/user.rss.eex | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/pleroma/web/activity_pub/mrf.ex b/lib/pleroma/web/activity_pub/mrf.ex index d03568444..02c0216a1 100644 --- a/lib/pleroma/web/activity_pub/mrf.ex +++ b/lib/pleroma/web/activity_pub/mrf.ex @@ -233,7 +233,7 @@ defmodule Pleroma.Web.ActivityPub.MRF do if function_exported?(policy, :config_description, 0) do description = @default_description - |> Map.merge(policy.config_description) + |> Map.merge(policy.config_description()) |> Map.put(:group, :pleroma) |> Map.put(:tab, :mrf) |> Map.put(:type, :group) diff --git a/lib/pleroma/web/templates/feed/feed/tag.atom.eex b/lib/pleroma/web/templates/feed/feed/tag.atom.eex index e85c08b2b..359f2cc11 100644 --- a/lib/pleroma/web/templates/feed/feed/tag.atom.eex +++ b/lib/pleroma/web/templates/feed/feed/tag.atom.eex @@ -9,13 +9,13 @@ xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:statusnet="http://status.net/schema/api/1/"> - <%= '#{url(~p"/tags/#{@tag}")}.rss' %> + <%= "#{url(~p"/tags/#{@tag}")}.rss" %> #<%= @tag %> <%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %> <%= feed_logo() %> <%= most_recent_update(@activities) %> - " type="application/atom+xml"/> + " type="application/atom+xml"/> <%= for activity <- @activities do %> <%= render @view_module, "_tag_activity.atom", Map.merge(assigns, prepare_activity(activity, actor: true)) %> <% end %> diff --git a/lib/pleroma/web/templates/feed/feed/tag.rss.eex b/lib/pleroma/web/templates/feed/feed/tag.rss.eex index 7ee3ba5a3..494e966ec 100644 --- a/lib/pleroma/web/templates/feed/feed/tag.rss.eex +++ b/lib/pleroma/web/templates/feed/feed/tag.rss.eex @@ -5,7 +5,7 @@ #<%= @tag %> <%= Gettext.dpgettext("static_pages", "tag feed description", "These are public toots tagged with #%{tag}. You can interact with them if you have an account anywhere in the fediverse.", tag: @tag) %> - <%= '#{url(~p"/tags/#{@tag}")}.rss' %> + <%= "#{url(~p"/tags/#{@tag}")}.rss" %> <%= feed_logo() %> 2b90d9 <%= for activity <- @activities do %> diff --git a/lib/pleroma/web/templates/feed/feed/user.atom.eex b/lib/pleroma/web/templates/feed/feed/user.atom.eex index 03585a9d5..6d370085c 100644 --- a/lib/pleroma/web/templates/feed/feed/user.atom.eex +++ b/lib/pleroma/web/templates/feed/feed/user.atom.eex @@ -10,12 +10,12 @@ <%= @user.nickname <> "'s timeline" %> <%= most_recent_update(@activities, @user) %> <%= logo(@user) %> - " type="application/atom+xml"/> + " type="application/atom+xml"/> <%= render @view_module, "_author.atom", assigns %> <%= if last_activity(@activities) do %> - " type="application/atom+xml"/> + " type="application/atom+xml"/> <% end %> <%= for activity <- @activities do %> diff --git a/lib/pleroma/web/templates/feed/feed/user.rss.eex b/lib/pleroma/web/templates/feed/feed/user.rss.eex index f2eb7337e..1cad6c5a0 100644 --- a/lib/pleroma/web/templates/feed/feed/user.rss.eex +++ b/lib/pleroma/web/templates/feed/feed/user.rss.eex @@ -5,12 +5,12 @@ <%= @user.nickname <> "'s timeline" %> <%= most_recent_update(@activities, @user) %> <%= logo(@user) %> - <%= '#{url(~p"/users/#{@user.nickname}/feed")}.rss' %> + <%= "#{url(~p"/users/#{@user.nickname}/feed")}.rss" %> <%= render @view_module, "_author.rss", assigns %> <%= if last_activity(@activities) do %> - <%= '#{url(~p"/users/#{@user.nickname}/feed")}.rss?max_id=#{last_activity(@activities).id}' %> + <%= "#{url(~p"/users/#{@user.nickname}/feed")}.rss?max_id=#{last_activity(@activities).id}" %> <% end %> <%= for activity <- @activities do %> From 1a4238bf986732e28c9a5803858e2d0b36a5dd85 Mon Sep 17 00:00:00 2001 From: Oneric Date: Wed, 19 Jun 2024 02:05:38 +0200 Subject: [PATCH 2/2] cosmetic: fix concurrent index creation warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since those old migrations will now most likely only run during db init, there’s not much point in running them in the background concurrently anyway, so just drop the cncurrent setting rather than disabling migration locks. --- .../repo/migrations/20170912114248_add_context_index.exs | 4 +--- .../20170916090107_add_fts_index_to_activities.exs | 2 -- priv/repo/migrations/20170917120416_add_tag_index.exs | 3 --- ...20171023155035_add_second_object_index_to_activty.exs | 5 +---- .../migrations/20171024121413_add_object_actor_index.exs | 9 +-------- .../migrations/20171109091239_add_actor_to_activity.exs | 4 +--- .../20171109141309_add_sort_index_to_activities.exs | 3 +-- ...0180325172351_add_follower_address_index_to_users.exs | 5 ++--- .../migrations/20180513104714_modify_activity_index.exs | 3 +-- .../20180606173637_create_apid_host_extraction_index.exs | 8 +------- ...0180617221540_create_activities_in_reply_to_index.exs | 8 +------- .../20190109152453_add_visibility_function.exs | 4 +--- .../20190127151220_add_activities_likes_index.exs | 2 -- .../migrations/20190204200237_add_correct_dm_index.exs | 3 --- .../20190405160700_add_index_on_subscribers.exs | 4 +--- ...0190710125051_add_following_address_index_to_user.exs | 3 +-- .../migrations/20191029172832_fix_blocked_follows.exs | 2 +- 17 files changed, 14 insertions(+), 58 deletions(-) diff --git a/priv/repo/migrations/20170912114248_add_context_index.exs b/priv/repo/migrations/20170912114248_add_context_index.exs index 400a432ff..864186850 100644 --- a/priv/repo/migrations/20170912114248_add_context_index.exs +++ b/priv/repo/migrations/20170912114248_add_context_index.exs @@ -1,12 +1,10 @@ defmodule Pleroma.Repo.Migrations.AddContextIndex do use Ecto.Migration - @disable_ddl_transaction true def change do create( index(:activities, ["(data->>'type')", "(data->>'context')"], - name: :activities_context_index, - concurrently: true + name: :activities_context_index ) ) end diff --git a/priv/repo/migrations/20170916090107_add_fts_index_to_activities.exs b/priv/repo/migrations/20170916090107_add_fts_index_to_activities.exs index 717e25412..2829e09bb 100644 --- a/priv/repo/migrations/20170916090107_add_fts_index_to_activities.exs +++ b/priv/repo/migrations/20170916090107_add_fts_index_to_activities.exs @@ -1,11 +1,9 @@ defmodule Pleroma.Repo.Migrations.AddFTSIndexToActivities do use Ecto.Migration - @disable_ddl_transaction true def change do create( index(:activities, ["(to_tsvector('english', data->'object'->>'content'))"], - concurrently: true, using: :gin, name: :activities_fts ) diff --git a/priv/repo/migrations/20170917120416_add_tag_index.exs b/priv/repo/migrations/20170917120416_add_tag_index.exs index c69e0ef8f..378f31cdc 100644 --- a/priv/repo/migrations/20170917120416_add_tag_index.exs +++ b/priv/repo/migrations/20170917120416_add_tag_index.exs @@ -1,12 +1,9 @@ defmodule Pleroma.Repo.Migrations.AddTagIndex do use Ecto.Migration - @disable_ddl_transaction true - def change do create( index(:activities, ["(data #> '{\"object\",\"tag\"}')"], - concurrently: true, using: :gin, name: :activities_tags ) diff --git a/priv/repo/migrations/20171023155035_add_second_object_index_to_activty.exs b/priv/repo/migrations/20171023155035_add_second_object_index_to_activty.exs index 261940a96..1cfb72479 100644 --- a/priv/repo/migrations/20171023155035_add_second_object_index_to_activty.exs +++ b/priv/repo/migrations/20171023155035_add_second_object_index_to_activty.exs @@ -1,8 +1,6 @@ defmodule Pleroma.Repo.Migrations.AddSecondObjectIndexToActivty do use Ecto.Migration - @disable_ddl_transaction true - def change do drop_if_exists( index(:activities, ["(data->'object'->>'id')", "(data->>'type')"], @@ -12,8 +10,7 @@ defmodule Pleroma.Repo.Migrations.AddSecondObjectIndexToActivty do create( index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"], - name: :activities_create_objects_index, - concurrently: true + name: :activities_create_objects_index ) ) end diff --git a/priv/repo/migrations/20171024121413_add_object_actor_index.exs b/priv/repo/migrations/20171024121413_add_object_actor_index.exs index 78084536c..ed1f0a437 100644 --- a/priv/repo/migrations/20171024121413_add_object_actor_index.exs +++ b/priv/repo/migrations/20171024121413_add_object_actor_index.exs @@ -1,14 +1,7 @@ defmodule Pleroma.Repo.Migrations.AddObjectActorIndex do use Ecto.Migration - @disable_ddl_transaction true - def change do - create( - index(:objects, ["(data->>'actor')", "(data->>'type')"], - concurrently: true, - name: :objects_actor_type - ) - ) + create(index(:objects, ["(data->>'actor')", "(data->>'type')"], name: :objects_actor_type)) end end diff --git a/priv/repo/migrations/20171109091239_add_actor_to_activity.exs b/priv/repo/migrations/20171109091239_add_actor_to_activity.exs index 91348f5c3..b465cd3e0 100644 --- a/priv/repo/migrations/20171109091239_add_actor_to_activity.exs +++ b/priv/repo/migrations/20171109091239_add_actor_to_activity.exs @@ -1,14 +1,12 @@ defmodule Pleroma.Repo.Migrations.AddActorToActivity do use Ecto.Migration - @disable_ddl_transaction true - def up do alter table(:activities) do add(:actor, :string) end - create(index(:activities, [:actor, "id DESC NULLS LAST"], concurrently: true)) + create(index(:activities, [:actor, "id DESC NULLS LAST"])) end def down do diff --git a/priv/repo/migrations/20171109141309_add_sort_index_to_activities.exs b/priv/repo/migrations/20171109141309_add_sort_index_to_activities.exs index 37fb2ce32..9e4fb1105 100644 --- a/priv/repo/migrations/20171109141309_add_sort_index_to_activities.exs +++ b/priv/repo/migrations/20171109141309_add_sort_index_to_activities.exs @@ -1,8 +1,7 @@ defmodule Pleroma.Repo.Migrations.AddSortIndexToActivities do use Ecto.Migration - @disable_ddl_transaction true def change do - create(index(:activities, ["id desc nulls last"], concurrently: true)) + create(index(:activities, ["id desc nulls last"])) end end diff --git a/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs b/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs index 18b54411c..80bbb71c8 100644 --- a/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs +++ b/priv/repo/migrations/20180325172351_add_follower_address_index_to_users.exs @@ -1,9 +1,8 @@ defmodule Pleroma.Repo.Migrations.AddFollowerAddressIndexToUsers do use Ecto.Migration - @disable_ddl_transaction true def change do - create(index(:users, [:follower_address], concurrently: true)) - create(index(:users, [:following], concurrently: true, using: :gin)) + create(index(:users, [:follower_address])) + create(index(:users, [:following], using: :gin)) end end diff --git a/priv/repo/migrations/20180513104714_modify_activity_index.exs b/priv/repo/migrations/20180513104714_modify_activity_index.exs index ec0efa238..5d528f2a1 100644 --- a/priv/repo/migrations/20180513104714_modify_activity_index.exs +++ b/priv/repo/migrations/20180513104714_modify_activity_index.exs @@ -1,9 +1,8 @@ defmodule Pleroma.Repo.Migrations.ModifyActivityIndex do use Ecto.Migration - @disable_ddl_transaction true def change do - create(index(:activities, ["id desc nulls last", "local"], concurrently: true)) + create(index(:activities, ["id desc nulls last", "local"])) drop_if_exists(index(:activities, ["id desc nulls last"])) end end diff --git a/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs b/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs index 07b3f2875..1b1ca2910 100644 --- a/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs +++ b/priv/repo/migrations/20180606173637_create_apid_host_extraction_index.exs @@ -1,13 +1,7 @@ defmodule Pleroma.Repo.Migrations.CreateApidHostExtractionIndex do use Ecto.Migration - @disable_ddl_transaction true def change do - create( - index(:activities, ["(split_part(actor, '/', 3))"], - concurrently: true, - name: :activities_hosts - ) - ) + create(index(:activities, ["(split_part(actor, '/', 3))"], name: :activities_hosts)) end end diff --git a/priv/repo/migrations/20180617221540_create_activities_in_reply_to_index.exs b/priv/repo/migrations/20180617221540_create_activities_in_reply_to_index.exs index c8a0e60a0..e5bb7c9a1 100644 --- a/priv/repo/migrations/20180617221540_create_activities_in_reply_to_index.exs +++ b/priv/repo/migrations/20180617221540_create_activities_in_reply_to_index.exs @@ -1,13 +1,7 @@ defmodule Pleroma.Repo.Migrations.CreateActivitiesInReplyToIndex do use Ecto.Migration - @disable_ddl_transaction true def change do - create( - index(:activities, ["(data->'object'->>'inReplyTo')"], - concurrently: true, - name: :activities_in_reply_to - ) - ) + create(index(:activities, ["(data->'object'->>'inReplyTo')"], name: :activities_in_reply_to)) end end diff --git a/priv/repo/migrations/20190109152453_add_visibility_function.exs b/priv/repo/migrations/20190109152453_add_visibility_function.exs index 43d1074aa..d5c6dc284 100644 --- a/priv/repo/migrations/20190109152453_add_visibility_function.exs +++ b/priv/repo/migrations/20190109152453_add_visibility_function.exs @@ -1,6 +1,5 @@ defmodule Pleroma.Repo.Migrations.AddVisibilityFunction do use Ecto.Migration - @disable_ddl_transaction true def up do definition = """ @@ -30,8 +29,7 @@ defmodule Pleroma.Repo.Migrations.AddVisibilityFunction do create( index(:activities, ["activity_visibility(actor, recipients, data)"], - name: :activities_visibility_index, - concurrently: true + name: :activities_visibility_index ) ) end diff --git a/priv/repo/migrations/20190127151220_add_activities_likes_index.exs b/priv/repo/migrations/20190127151220_add_activities_likes_index.exs index 115b12491..9a4008122 100644 --- a/priv/repo/migrations/20190127151220_add_activities_likes_index.exs +++ b/priv/repo/migrations/20190127151220_add_activities_likes_index.exs @@ -1,11 +1,9 @@ defmodule Pleroma.Repo.Migrations.AddActivitiesLikesIndex do use Ecto.Migration - @disable_ddl_transaction true def change do create( index(:activities, ["((data #> '{\"object\",\"likes\"}'))"], - concurrently: true, name: :activities_likes, using: :gin ) diff --git a/priv/repo/migrations/20190204200237_add_correct_dm_index.exs b/priv/repo/migrations/20190204200237_add_correct_dm_index.exs index 1facb37b8..16ef0f1ab 100644 --- a/priv/repo/migrations/20190204200237_add_correct_dm_index.exs +++ b/priv/repo/migrations/20190204200237_add_correct_dm_index.exs @@ -1,6 +1,5 @@ defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do use Ecto.Migration - @disable_ddl_transaction true def up do drop_if_exists( @@ -12,7 +11,6 @@ defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do create( index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"], name: :activities_visibility_index, - concurrently: true, where: "data->>'type' = 'Create'" ) ) @@ -22,7 +20,6 @@ defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do drop_if_exists( index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"], name: :activities_visibility_index, - concurrently: true, where: "data->>'type' = 'Create'" ) ) diff --git a/priv/repo/migrations/20190405160700_add_index_on_subscribers.exs b/priv/repo/migrations/20190405160700_add_index_on_subscribers.exs index bbf47f72c..0b1bcef03 100644 --- a/priv/repo/migrations/20190405160700_add_index_on_subscribers.exs +++ b/priv/repo/migrations/20190405160700_add_index_on_subscribers.exs @@ -1,13 +1,11 @@ defmodule Pleroma.Repo.Migrations.AddIndexOnSubscribers do use Ecto.Migration - @disable_ddl_transaction true def change do create( index(:users, ["(info->'subscribers')"], name: :users_subscribers_index, - using: :gin, - concurrently: true + using: :gin ) ) end diff --git a/priv/repo/migrations/20190710125051_add_following_address_index_to_user.exs b/priv/repo/migrations/20190710125051_add_following_address_index_to_user.exs index 0cbfb71f4..7fadc9f9a 100644 --- a/priv/repo/migrations/20190710125051_add_following_address_index_to_user.exs +++ b/priv/repo/migrations/20190710125051_add_following_address_index_to_user.exs @@ -1,8 +1,7 @@ defmodule Pleroma.Repo.Migrations.AddFollowingAddressIndexToUser do use Ecto.Migration - @disable_ddl_transaction true def change do - create(index(:users, [:following_address], concurrently: true)) + create(index(:users, [:following_address])) end end diff --git a/priv/repo/migrations/20191029172832_fix_blocked_follows.exs b/priv/repo/migrations/20191029172832_fix_blocked_follows.exs index 71f8f1330..6e72ebdb0 100644 --- a/priv/repo/migrations/20191029172832_fix_blocked_follows.exs +++ b/priv/repo/migrations/20191029172832_fix_blocked_follows.exs @@ -100,7 +100,7 @@ defmodule Pleroma.Repo.Migrations.FixBlockedFollows do "users" |> where(id: ^user_id) - |> join(:inner, [u], s in subquery(follower_count_query)) + |> join(:inner, [u], s in subquery(follower_count_query), on: true) |> update([u, s], set: [follower_count: s.count] )