From 8ad166e8e385b7baea79dc3949b438edba25c69f Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 3 Jul 2020 12:46:28 +0200 Subject: Migrations: Add `accepts_chat_messages` to users. --- .../20200703101031_add_chat_acceptance_to_users.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs (limited to 'priv') diff --git a/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs new file mode 100644 index 000000000..4ae3c4201 --- /dev/null +++ b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs @@ -0,0 +1,12 @@ +defmodule Pleroma.Repo.Migrations.AddChatAcceptanceToUsers do + use Ecto.Migration + + def change do + alter table(:users) do + add(:accepts_chat_messages, :boolean, nullable: false, default: false) + end + + # Looks stupid but makes the update much faster + execute("update users set accepts_chat_messages = local where local = true") + end +end -- cgit v1.2.3 From 37fdb05058d17abde11fd3e55ce896464c7d22e4 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 3 Jul 2020 13:12:23 +0200 Subject: User, Migration: Change `accepts_chat_messages` to be nullable This is to model the ambiguous state of most users. --- .../20200703101031_add_chat_acceptance_to_users.exs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'priv') diff --git a/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs index 4ae3c4201..8dfda89f1 100644 --- a/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs +++ b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs @@ -1,12 +1,17 @@ defmodule Pleroma.Repo.Migrations.AddChatAcceptanceToUsers do use Ecto.Migration - def change do + def up do alter table(:users) do - add(:accepts_chat_messages, :boolean, nullable: false, default: false) + add(:accepts_chat_messages, :boolean, nullable: true) end - # Looks stupid but makes the update much faster - execute("update users set accepts_chat_messages = local where local = true") + execute("update users set accepts_chat_messages = true where local = true") + end + + def down do + alter table(:users) do + remove(:accepts_chat_messages) + end end end -- cgit v1.2.3 From 8289ec67a80697a1a4843c0ea50e66b01bf3bb00 Mon Sep 17 00:00:00 2001 From: lain Date: Fri, 3 Jul 2020 13:39:21 +0200 Subject: Litepub: Add acceptsChatMessages to schema. --- priv/static/schemas/litepub-0.1.jsonld | 1 + 1 file changed, 1 insertion(+) (limited to 'priv') diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld index 7cc3fee40..c1bcad0f8 100644 --- a/priv/static/schemas/litepub-0.1.jsonld +++ b/priv/static/schemas/litepub-0.1.jsonld @@ -13,6 +13,7 @@ }, "discoverable": "toot:discoverable", "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", + "acceptsChatMessages": "litepub:acceptsChatMessages", "ostatus": "http://ostatus.org#", "schema": "http://schema.org#", "toot": "http://joinmastodon.org/ns#", -- cgit v1.2.3 From 208baf157ad0c8be470566d5d51d0214c229e6a5 Mon Sep 17 00:00:00 2001 From: lain Date: Mon, 6 Jul 2020 11:38:40 +0200 Subject: ActivityPub: Add new 'capabilities' to user. --- priv/static/schemas/litepub-0.1.jsonld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'priv') diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld index c1bcad0f8..e7722cf72 100644 --- a/priv/static/schemas/litepub-0.1.jsonld +++ b/priv/static/schemas/litepub-0.1.jsonld @@ -13,7 +13,7 @@ }, "discoverable": "toot:discoverable", "manuallyApprovesFollowers": "as:manuallyApprovesFollowers", - "acceptsChatMessages": "litepub:acceptsChatMessages", + "capabilities": "litepub:capabilities", "ostatus": "http://ostatus.org#", "schema": "http://schema.org#", "toot": "http://joinmastodon.org/ns#", -- cgit v1.2.3