Introduce group basic federation, event new page and notifications

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2020-02-18 08:57:00 +01:00
parent 300ef8f245
commit 4144e9ffd0
416 changed files with 32220 additions and 16750 deletions

View File

@@ -4,7 +4,7 @@ defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
def up do
Mobilizon.Events.EventVisibility.create_type()
Mobilizon.Events.EventStatus.create_type()
Mobilizon.Events.CommentVisibility.create_type()
Mobilizon.Conversations.CommentVisibility.create_type()
alter table(:events) do
remove(:public)
@@ -15,7 +15,7 @@ defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
end
alter table(:comments) do
add(:visibility, Mobilizon.Events.CommentVisibility.type())
add(:visibility, Mobilizon.Conversations.CommentVisibility.type())
end
end
@@ -34,6 +34,6 @@ defmodule Mobilizon.Repo.Migrations.FixEventVisibility do
Mobilizon.Events.EventVisibility.drop_type()
Mobilizon.Events.EventStatus.drop_type()
Mobilizon.Events.CommentVisibility.drop_type()
Mobilizon.Conversations.CommentVisibility.drop_type()
end
end

View File

@@ -2,8 +2,9 @@ defmodule Mobilizon.Storage.Repo.Migrations.RenamePostgresTypes do
use Ecto.Migration
alias Mobilizon.Actors.{ActorVisibility, MemberRole}
alias alias Mobilizon.Conversations.CommentVisibility
alias Mobilizon.Events.{
CommentVisibility,
JoinOptions,
EventStatus,
EventVisibility,

View File

@@ -0,0 +1,14 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddNewRolesToMember do
use Ecto.Migration
@disable_ddl_transaction true
def up do
Ecto.Migration.execute("ALTER TYPE member_role ADD VALUE IF NOT EXISTS 'invited'")
Ecto.Migration.execute("ALTER TYPE member_role ADD VALUE IF NOT EXISTS 'rejected'")
end
def down do
IO.puts("Not removing value 'invited' from member_role type")
IO.puts("Not removing value 'rejected' from member_role type")
end
end

View File

@@ -0,0 +1,21 @@
defmodule Mobilizon.Storage.Repo.Migrations.MoveMemberIdToUuid do
use Ecto.Migration
def up do
alter table(:members, primary_key: false) do
remove(:id)
add(:id, :uuid, primary_key: true)
add(:url, :string, null: false)
add(:metadata, :map)
end
end
def down do
alter table(:members, primary_key: true) do
remove(:id)
remove(:url)
remove(:metadata)
add(:id, :serial, primary_key: true)
end
end
end

View File

@@ -0,0 +1,15 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddMembersEndpointToActors do
use Ecto.Migration
def up do
alter table(:actors) do
add(:members_url, :string, null: true)
end
end
def down do
alter table(:actors) do
remove(:members_url)
end
end
end

View File

@@ -0,0 +1,28 @@
defmodule Mobilizon.Repo.Migrations.CreateTodos do
use Ecto.Migration
def change do
create table(:todo_lists, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:title, :string)
add(:url, :string)
add(:actor_id, references(:actors, on_delete: :delete_all), null: false)
timestamps()
end
create table(:todos, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:title, :string)
add(:url, :string)
add(:status, :boolean, default: false, null: false)
add(:due_date, :utc_datetime)
add(:creator_id, references(:actors, on_delete: :delete_all), null: false)
add(:assigned_to_id, references(:actors, on_delete: :nilify_all))
add(:todo_list_id, references(:todo_lists, on_delete: :delete_all, type: :uuid), null: false)
timestamps()
end
end
end

View File

@@ -0,0 +1,23 @@
defmodule Mobilizon.Repo.Migrations.CreateResources do
use Ecto.Migration
def change do
create table(:resource, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:title, :string, null: false)
add(:url, :string, null: false)
add(:type, :integer, null: false)
add(:summary, :text)
add(:resource_url, :string)
add(:metadata, :map)
add(:path, :string, null: false)
add(:parent_id, references(:resource, on_delete: :delete_all, type: :uuid), null: true)
add(:actor_id, references(:actors, on_delete: :delete_all), null: false)
add(:creator_id, references(:actors, on_delete: :nilify_all), null: true)
timestamps()
end
end
end

View File

@@ -0,0 +1,18 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddConversations do
use Ecto.Migration
def change do
create table(:conversations) do
add(:title, :string)
add(:slug, :string)
add(:actor_id, references(:actors, on_delete: :delete_all), null: false)
add(:creator_id, references(:actors, on_delete: :nilify_all))
add(:last_comment_id, references(:comments, on_delete: :delete_all))
timestamps()
end
alter table(:comments) do
add(:conversation_id, references(:conversations, on_delete: :delete_all))
end
end
end

View File

@@ -0,0 +1,9 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddNumberEditsToComment do
use Ecto.Migration
def change do
alter table(:comments) do
add(:edits, :integer, default: 0)
end
end
end

View File

@@ -0,0 +1,10 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddResourcesAndTodosEndpointsToActor do
use Ecto.Migration
def change do
alter table(:actors) do
add(:resources_url, :string, null: true)
add(:todos_url, :string, null: true)
end
end
end

View File

@@ -0,0 +1,17 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddLocalAttributeToResourcesAndTodos do
use Ecto.Migration
def change do
alter table(:resource) do
add(:local, :boolean, default: true)
end
alter table(:todo_lists) do
add(:local, :boolean, default: true)
end
alter table(:todos) do
add(:local, :boolean, default: true)
end
end
end

View File

@@ -0,0 +1,9 @@
defmodule Mobilizon.Storage.Repo.Migrations.MoveInviterFromMetadataToMemberTable do
use Ecto.Migration
def change do
alter table(:members) do
add(:invited_by_id, references(:actors, on_delete: :nilify_all))
end
end
end

View File

@@ -0,0 +1,10 @@
defmodule Mobilizon.Storage.Repo.Migrations.AddUniqueURLContraintToSomeTables do
use Ecto.Migration
def change do
create(unique_index(:members, [:url]))
create(unique_index(:resource, [:url]))
create(unique_index(:todo_lists, [:url]))
create(unique_index(:todos, [:url]))
end
end

View File

@@ -0,0 +1,15 @@
defmodule Mobilizon.Repo.Migrations.CreateUserSettings do
use Ecto.Migration
def change do
create table(:user_settings, primary_key: false) do
add(:timezone, :string)
add(:notification_on_day, :boolean)
add(:notification_each_week, :boolean)
add(:notification_before_event, :boolean)
add(:user_id, references(:users, on_delete: :delete_all), primary_key: true)
timestamps()
end
end
end