From 5f7d47dcb7ac3f5397ef5f8e6726f9f819fca84a Mon Sep 17 00:00:00 2001 From: Oneric Date: Sun, 11 Feb 2024 01:19:03 +0100 Subject: [PATCH 1/2] Drop obolete chat/shoutbox config options Their functions were purged in 0f132b802dde7f217ecb07767e0d34e3edb517b7 --- config/config.exs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/config/config.exs b/config/config.exs index 9a3cdcebf..27c314e01 100644 --- a/config/config.exs +++ b/config/config.exs @@ -290,7 +290,6 @@ alwaysShowSubjectInput: true, background: "/images/city.jpg", collapseMessageWithSubject: false, - disableChat: false, greentext: false, hideFilteredStatuses: false, hideMutedPosts: false, @@ -453,10 +452,6 @@ image_quality: 85, min_content_length: 100 * 1024 -config :pleroma, :shout, - enabled: true, - limit: 5_000 - config :phoenix, :format_encoders, json: Jason, "activity+json": Jason config :phoenix, :json_library, Jason From 8cf183cb428ee5f0e368d872ae4e6e63b6f63c12 Mon Sep 17 00:00:00 2001 From: Oneric Date: Sun, 11 Feb 2024 02:02:24 +0100 Subject: [PATCH 2/2] Drop Chat tables Chats were removed in 0f132b802dde7f217ecb07767e0d34e3edb517b7 --- .../20240210000000_drop_chat_tables.exs | 50 +++++++++++++++++++ test/mix/tasks/pleroma/database_test.exs | 2 - 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 priv/repo/migrations/20240210000000_drop_chat_tables.exs diff --git a/priv/repo/migrations/20240210000000_drop_chat_tables.exs b/priv/repo/migrations/20240210000000_drop_chat_tables.exs new file mode 100644 index 000000000..f83524e4d --- /dev/null +++ b/priv/repo/migrations/20240210000000_drop_chat_tables.exs @@ -0,0 +1,50 @@ +defmodule Pleroma.Repo.Migrations.DropChatTables do + use Ecto.Migration + + def up do + # Automatically drops associated indices and constraints + drop table(:chat_message_references) + drop table(:chats) + end + + def down do + # Ecto's default primary key is bigserial, thus configure manually + create table(:chats, primary_key: false) do + add(:id, :uuid, primary_key: true, autogenerated: true) + + add( + :user_id, + references(:users, type: :uuid, on_delete: :delete_all) + # yes, this was nullable + ) + + add( + :recipient, + references(:users, column: :ap_id, type: :string, on_delete: :delete_all) + # yes, this was nullable + ) + + timestamps() + end + + create(index(:chats, [:user_id, :recipient], unique: true)) + + create table(:chat_message_references, primary_key: false) do + add(:id, :uuid, primary_key: true, autogenerated: true) + add(:chat_id, references(:chats, type: :uuid, on_delete: :delete_all), null: false) + add(:object_id, references(:objects, on_delete: :delete_all), null: false) + add(:unread, :boolean, default: true, null: false) + timestamps() + end + + create(index(:chat_message_references, [:chat_id, "id desc"])) + create(unique_index(:chat_message_references, [:object_id, :chat_id])) + + create( + index(:chat_message_references, [:chat_id], + where: "unread = true", + name: "unread_messages_count_index" + ) + ) + end +end diff --git a/test/mix/tasks/pleroma/database_test.exs b/test/mix/tasks/pleroma/database_test.exs index 40c5fd402..97fa830ff 100644 --- a/test/mix/tasks/pleroma/database_test.exs +++ b/test/mix/tasks/pleroma/database_test.exs @@ -371,8 +371,6 @@ test "We don't have unexpected tables which may contain objects that are referen ["apps"], ["backups"], ["bookmarks"], - ["chat_message_references"], - ["chats"], ["config"], ["conversation_participation_recipient_ships"], ["conversation_participations"],