feat: Add option to link an external registration provider for events

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Luca Eichler
2021-10-19 15:56:18 +02:00
committed by Thomas Citharel
parent 4fb1282e76
commit 2de6937407
14 changed files with 160 additions and 9 deletions

View File

@@ -78,6 +78,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
visibility: visibility,
join_options: Map.get(object, "joinMode", "free"),
local: is_local?(object["id"]),
external_participation_url: object["externalParticipationUrl"],
options: options,
metadata: metadata,
status: object |> Map.get("ical:status", "CONFIRMED") |> String.downcase(),
@@ -129,6 +130,7 @@ defmodule Mobilizon.Federation.ActivityStream.Converter.Event do
"mediaType" => "text/html",
"startTime" => event.begins_on |> shift_tz(event.options.timezone) |> date_to_string(),
"joinMode" => to_string(event.join_options),
"externalParticipationUrl" => event.external_participation_url,
"endTime" => event.ends_on |> shift_tz(event.options.timezone) |> date_to_string(),
"tag" => event.tags |> build_tags(),
"maximumAttendeeCapacity" => event.options.maximum_attendee_capacity,

View File

@@ -35,6 +35,7 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
field(:status, :event_status, description: "Status of the event")
field(:visibility, :event_visibility, description: "The event's visibility")
field(:join_options, :event_join_options, description: "The event's visibility")
field(:external_participation_url, :string, description: "External URL for participation")
field(:picture, :media,
description: "The event's picture",
@@ -130,6 +131,7 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
value(:free, description: "Anyone can join and is automatically accepted")
value(:restricted, description: "Manual acceptation")
value(:invite, description: "Participants must be invited")
value(:external, description: "External registration")
end
@desc "The list of possible options for the event's status"
@@ -398,6 +400,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description: "The event's options to join"
)
arg(:external_participation_url, :string, description: "External URL for participation")
arg(:tags, list_of(:string),
default_value: [],
description: "The list of tags associated to the event"
@@ -469,6 +473,8 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
description: "The event's options to join"
)
arg(:external_participation_url, :string, description: "External URL for participation")
arg(:tags, list_of(:string), description: "The list of tags associated to the event")
arg(:picture, :media_input,

View File

@@ -47,6 +47,7 @@ defmodule Mobilizon.Events.Event do
draft: boolean,
visibility: atom(),
join_options: atom(),
external_participation_url: String.t(),
publish_at: DateTime.t() | nil,
uuid: Ecto.UUID.t(),
online_address: String.t() | nil,
@@ -81,6 +82,7 @@ defmodule Mobilizon.Events.Event do
:local,
:visibility,
:join_options,
:external_participation_url,
:publish_at,
:online_address,
:phone_address,
@@ -105,6 +107,7 @@ defmodule Mobilizon.Events.Event do
field(:draft, :boolean, default: false)
field(:visibility, EventVisibility, default: :public)
field(:join_options, JoinOptions, default: :free)
field(:external_participation_url, :string)
field(:publish_at, :utc_datetime)
field(:uuid, Ecto.UUID, default: Ecto.UUID.generate())
field(:online_address, :string)

View File

@@ -46,7 +46,8 @@ defmodule Mobilizon.Events do
defenum(JoinOptions, :join_options, [
:free,
:restricted,
:invite
:invite,
:external
])
defenum(EventStatus, :event_status, [