Merge pull request 'Fix elixir 1.17 and migration lock warnings' (#810) from Oneric/akkoma:ex1.17-warnings into develop

Reviewed-on: AkkomaGang/akkoma#810
This commit is contained in:
floatingghost 2024-06-23 02:18:41 +00:00
commit dc34328f15
22 changed files with 22 additions and 66 deletions

View file

@ -233,7 +233,7 @@ def config_descriptions(policies) do
if function_exported?(policy, :config_description, 0) do if function_exported?(policy, :config_description, 0) do
description = description =
@default_description @default_description
|> Map.merge(policy.config_description) |> Map.merge(policy.config_description())
|> Map.put(:group, :pleroma) |> Map.put(:group, :pleroma)
|> Map.put(:tab, :mrf) |> Map.put(:tab, :mrf)
|> Map.put(:type, :group) |> Map.put(:type, :group)

View file

@ -9,13 +9,13 @@
xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0"
xmlns:statusnet="http://status.net/schema/api/1/"> xmlns:statusnet="http://status.net/schema/api/1/">
<id><%= '#{url(~p"/tags/#{@tag}")}.rss' %></id> <id><%= "#{url(~p"/tags/#{@tag}")}.rss" %></id>
<title>#<%= @tag %></title> <title>#<%= @tag %></title>
<subtitle><%= 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) %></subtitle> <subtitle><%= 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) %></subtitle>
<logo><%= feed_logo() %></logo> <logo><%= feed_logo() %></logo>
<updated><%= most_recent_update(@activities) %></updated> <updated><%= most_recent_update(@activities) %></updated>
<link rel="self" href="<%= '#{url(~p"/tags/#{@tag}")}.atom' %>" type="application/atom+xml"/> <link rel="self" href="<%= "#{url(~p"/tags/#{@tag}")}.atom" %>" type="application/atom+xml"/>
<%= for activity <- @activities do %> <%= for activity <- @activities do %>
<%= render @view_module, "_tag_activity.atom", Map.merge(assigns, prepare_activity(activity, actor: true)) %> <%= render @view_module, "_tag_activity.atom", Map.merge(assigns, prepare_activity(activity, actor: true)) %>
<% end %> <% end %>

View file

@ -5,7 +5,7 @@
<title>#<%= @tag %></title> <title>#<%= @tag %></title>
<description><%= 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) %></description> <description><%= 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) %></description>
<link><%= '#{url(~p"/tags/#{@tag}")}.rss' %></link> <link><%= "#{url(~p"/tags/#{@tag}")}.rss" %></link>
<webfeeds:logo><%= feed_logo() %></webfeeds:logo> <webfeeds:logo><%= feed_logo() %></webfeeds:logo>
<webfeeds:accentColor>2b90d9</webfeeds:accentColor> <webfeeds:accentColor>2b90d9</webfeeds:accentColor>
<%= for activity <- @activities do %> <%= for activity <- @activities do %>

View file

@ -10,12 +10,12 @@
<title><%= @user.nickname <> "'s timeline" %></title> <title><%= @user.nickname <> "'s timeline" %></title>
<updated><%= most_recent_update(@activities, @user) %></updated> <updated><%= most_recent_update(@activities, @user) %></updated>
<logo><%= logo(@user) %></logo> <logo><%= logo(@user) %></logo>
<link rel="self" href="<%= '#{url(~p"/users/#{@user.nickname}/feed")}.atom' %>" type="application/atom+xml"/> <link rel="self" href="<%= "#{url(~p"/users/#{@user.nickname}/feed")}.atom" %>" type="application/atom+xml"/>
<%= render @view_module, "_author.atom", assigns %> <%= render @view_module, "_author.atom", assigns %>
<%= if last_activity(@activities) do %> <%= if last_activity(@activities) do %>
<link rel="next" href="<%= '#{url(~p"/users/#{@user.nickname}/feed")}.atom?max_id=#{last_activity(@activities).id}' %>" type="application/atom+xml"/> <link rel="next" href="<%= "#{url(~p"/users/#{@user.nickname}/feed")}.atom?max_id=#{last_activity(@activities).id}" %>" type="application/atom+xml"/>
<% end %> <% end %>
<%= for activity <- @activities do %> <%= for activity <- @activities do %>

View file

@ -5,12 +5,12 @@
<title><%= @user.nickname <> "'s timeline" %></title> <title><%= @user.nickname <> "'s timeline" %></title>
<updated><%= most_recent_update(@activities, @user) %></updated> <updated><%= most_recent_update(@activities, @user) %></updated>
<image><%= logo(@user) %></image> <image><%= logo(@user) %></image>
<link><%= '#{url(~p"/users/#{@user.nickname}/feed")}.rss' %></link> <link><%= "#{url(~p"/users/#{@user.nickname}/feed")}.rss" %></link>
<%= render @view_module, "_author.rss", assigns %> <%= render @view_module, "_author.rss", assigns %>
<%= if last_activity(@activities) do %> <%= if last_activity(@activities) do %>
<link rel="next"><%= '#{url(~p"/users/#{@user.nickname}/feed")}.rss?max_id=#{last_activity(@activities).id}' %></link> <link rel="next"><%= "#{url(~p"/users/#{@user.nickname}/feed")}.rss?max_id=#{last_activity(@activities).id}" %></link>
<% end %> <% end %>
<%= for activity <- @activities do %> <%= for activity <- @activities do %>

View file

@ -1,12 +1,10 @@
defmodule Pleroma.Repo.Migrations.AddContextIndex do defmodule Pleroma.Repo.Migrations.AddContextIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(
index(:activities, ["(data->>'type')", "(data->>'context')"], index(:activities, ["(data->>'type')", "(data->>'context')"],
name: :activities_context_index, name: :activities_context_index
concurrently: true
) )
) )
end end

View file

@ -1,11 +1,9 @@
defmodule Pleroma.Repo.Migrations.AddFTSIndexToActivities do defmodule Pleroma.Repo.Migrations.AddFTSIndexToActivities do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(
index(:activities, ["(to_tsvector('english', data->'object'->>'content'))"], index(:activities, ["(to_tsvector('english', data->'object'->>'content'))"],
concurrently: true,
using: :gin, using: :gin,
name: :activities_fts name: :activities_fts
) )

View file

@ -1,12 +1,9 @@
defmodule Pleroma.Repo.Migrations.AddTagIndex do defmodule Pleroma.Repo.Migrations.AddTagIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(
index(:activities, ["(data #> '{\"object\",\"tag\"}')"], index(:activities, ["(data #> '{\"object\",\"tag\"}')"],
concurrently: true,
using: :gin, using: :gin,
name: :activities_tags name: :activities_tags
) )

View file

@ -1,8 +1,6 @@
defmodule Pleroma.Repo.Migrations.AddSecondObjectIndexToActivty do defmodule Pleroma.Repo.Migrations.AddSecondObjectIndexToActivty do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
drop_if_exists( drop_if_exists(
index(:activities, ["(data->'object'->>'id')", "(data->>'type')"], index(:activities, ["(data->'object'->>'id')", "(data->>'type')"],
@ -12,8 +10,7 @@ def change do
create( create(
index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"], index(:activities, ["(coalesce(data->'object'->>'id', data->>'object'))"],
name: :activities_create_objects_index, name: :activities_create_objects_index
concurrently: true
) )
) )
end end

View file

@ -1,14 +1,7 @@
defmodule Pleroma.Repo.Migrations.AddObjectActorIndex do defmodule Pleroma.Repo.Migrations.AddObjectActorIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(index(:objects, ["(data->>'actor')", "(data->>'type')"], name: :objects_actor_type))
index(:objects, ["(data->>'actor')", "(data->>'type')"],
concurrently: true,
name: :objects_actor_type
)
)
end end
end end

View file

@ -1,14 +1,12 @@
defmodule Pleroma.Repo.Migrations.AddActorToActivity do defmodule Pleroma.Repo.Migrations.AddActorToActivity do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def up do def up do
alter table(:activities) do alter table(:activities) do
add(:actor, :string) add(:actor, :string)
end end
create(index(:activities, [:actor, "id DESC NULLS LAST"], concurrently: true)) create(index(:activities, [:actor, "id DESC NULLS LAST"]))
end end
def down do def down do

View file

@ -1,8 +1,7 @@
defmodule Pleroma.Repo.Migrations.AddSortIndexToActivities do defmodule Pleroma.Repo.Migrations.AddSortIndexToActivities do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create(index(:activities, ["id desc nulls last"], concurrently: true)) create(index(:activities, ["id desc nulls last"]))
end end
end end

View file

@ -1,9 +1,8 @@
defmodule Pleroma.Repo.Migrations.AddFollowerAddressIndexToUsers do defmodule Pleroma.Repo.Migrations.AddFollowerAddressIndexToUsers do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create(index(:users, [:follower_address], concurrently: true)) create(index(:users, [:follower_address]))
create(index(:users, [:following], concurrently: true, using: :gin)) create(index(:users, [:following], using: :gin))
end end
end end

View file

@ -1,9 +1,8 @@
defmodule Pleroma.Repo.Migrations.ModifyActivityIndex do defmodule Pleroma.Repo.Migrations.ModifyActivityIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do 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"])) drop_if_exists(index(:activities, ["id desc nulls last"]))
end end
end end

View file

@ -1,13 +1,7 @@
defmodule Pleroma.Repo.Migrations.CreateApidHostExtractionIndex do defmodule Pleroma.Repo.Migrations.CreateApidHostExtractionIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(index(:activities, ["(split_part(actor, '/', 3))"], name: :activities_hosts))
index(:activities, ["(split_part(actor, '/', 3))"],
concurrently: true,
name: :activities_hosts
)
)
end end
end end

View file

@ -1,13 +1,7 @@
defmodule Pleroma.Repo.Migrations.CreateActivitiesInReplyToIndex do defmodule Pleroma.Repo.Migrations.CreateActivitiesInReplyToIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(index(:activities, ["(data->'object'->>'inReplyTo')"], name: :activities_in_reply_to))
index(:activities, ["(data->'object'->>'inReplyTo')"],
concurrently: true,
name: :activities_in_reply_to
)
)
end end
end end

View file

@ -1,6 +1,5 @@
defmodule Pleroma.Repo.Migrations.AddVisibilityFunction do defmodule Pleroma.Repo.Migrations.AddVisibilityFunction do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def up do def up do
definition = """ definition = """
@ -30,8 +29,7 @@ def up do
create( create(
index(:activities, ["activity_visibility(actor, recipients, data)"], index(:activities, ["activity_visibility(actor, recipients, data)"],
name: :activities_visibility_index, name: :activities_visibility_index
concurrently: true
) )
) )
end end

View file

@ -1,11 +1,9 @@
defmodule Pleroma.Repo.Migrations.AddActivitiesLikesIndex do defmodule Pleroma.Repo.Migrations.AddActivitiesLikesIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(
index(:activities, ["((data #> '{\"object\",\"likes\"}'))"], index(:activities, ["((data #> '{\"object\",\"likes\"}'))"],
concurrently: true,
name: :activities_likes, name: :activities_likes,
using: :gin using: :gin
) )

View file

@ -1,6 +1,5 @@
defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do defmodule Pleroma.Repo.Migrations.AddCorrectDMIndex do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def up do def up do
drop_if_exists( drop_if_exists(
@ -12,7 +11,6 @@ def up do
create( create(
index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"], index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC NULLS LAST"],
name: :activities_visibility_index, name: :activities_visibility_index,
concurrently: true,
where: "data->>'type' = 'Create'" where: "data->>'type' = 'Create'"
) )
) )
@ -22,7 +20,6 @@ def down do
drop_if_exists( drop_if_exists(
index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"], index(:activities, ["activity_visibility(actor, recipients, data)", "id DESC"],
name: :activities_visibility_index, name: :activities_visibility_index,
concurrently: true,
where: "data->>'type' = 'Create'" where: "data->>'type' = 'Create'"
) )
) )

View file

@ -1,13 +1,11 @@
defmodule Pleroma.Repo.Migrations.AddIndexOnSubscribers do defmodule Pleroma.Repo.Migrations.AddIndexOnSubscribers do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create( create(
index(:users, ["(info->'subscribers')"], index(:users, ["(info->'subscribers')"],
name: :users_subscribers_index, name: :users_subscribers_index,
using: :gin, using: :gin
concurrently: true
) )
) )
end end

View file

@ -1,8 +1,7 @@
defmodule Pleroma.Repo.Migrations.AddFollowingAddressIndexToUser do defmodule Pleroma.Repo.Migrations.AddFollowingAddressIndexToUser do
use Ecto.Migration use Ecto.Migration
@disable_ddl_transaction true
def change do def change do
create(index(:users, [:following_address], concurrently: true)) create(index(:users, [:following_address]))
end end
end end

View file

@ -100,7 +100,7 @@ def update_follower_count(%{id: user_id} = user) do
"users" "users"
|> where(id: ^user_id) |> 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], |> update([u, s],
set: [follower_count: s.count] set: [follower_count: s.count]
) )