aboutsummaryrefslogtreecommitdiff
path: root/priv
diff options
context:
space:
mode:
Diffstat (limited to 'priv')
-rw-r--r--priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs26
-rw-r--r--priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs24
-rw-r--r--priv/static/schemas/litepub-0.1.jsonld4
3 files changed, 54 insertions, 0 deletions
diff --git a/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs b/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs
new file mode 100644
index 000000000..3c32bc355
--- /dev/null
+++ b/priv/repo/migrations/20190516112144_add_ap_id_to_lists.exs
@@ -0,0 +1,26 @@
+defmodule Pleroma.Repo.Migrations.AddApIdToLists do
+ use Ecto.Migration
+
+ def up do
+ alter table(:lists) do
+ add(:ap_id, :string)
+ end
+
+ execute("""
+ UPDATE lists
+ SET ap_id = u.ap_id || '/lists/' || lists.id
+ FROM users AS u
+ WHERE lists.user_id = u.id
+ """)
+
+ create(unique_index(:lists, :ap_id))
+ end
+
+ def down do
+ drop(index(:lists, [:ap_id]))
+
+ alter table(:lists) do
+ remove(:ap_id)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs b/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs
new file mode 100644
index 000000000..50669902e
--- /dev/null
+++ b/priv/repo/migrations/20190711042024_copy_muted_to_muted_notifications.exs
@@ -0,0 +1,24 @@
+defmodule Pleroma.Repo.Migrations.CopyMutedToMutedNotifications do
+ use Ecto.Migration
+ alias Pleroma.User
+
+ def change do
+ query =
+ User.Query.build(%{
+ local: true,
+ active: true,
+ order_by: :id
+ })
+
+ Pleroma.Repo.stream(query)
+ |> Enum.each(fn
+ %{info: %{mutes: mutes} = info} = user ->
+ info_cng =
+ Ecto.Changeset.cast(info, %{muted_notifications: mutes}, [:muted_notifications])
+
+ Ecto.Changeset.change(user)
+ |> Ecto.Changeset.put_embed(:info, info_cng)
+ |> Pleroma.Repo.update()
+ end)
+ end
+end
diff --git a/priv/static/schemas/litepub-0.1.jsonld b/priv/static/schemas/litepub-0.1.jsonld
index f36b231c5..57ed05eba 100644
--- a/priv/static/schemas/litepub-0.1.jsonld
+++ b/priv/static/schemas/litepub-0.1.jsonld
@@ -20,6 +20,10 @@
"sensitive": "as:sensitive",
"litepub": "http://litepub.social/ns#",
"directMessage": "litepub:directMessage",
+ "listMessage": {
+ "@id": "litepub:listMessage",
+ "@type": "@id"
+ },
"oauthRegistrationEndpoint": {
"@id": "litepub:oauthRegistrationEndpoint",
"@type": "@id"