@@ -22,7 +22,9 @@ defmodule Mobilizon.Events.EventOptions do
|
||||
comment_moderation: CommentModeration.t(),
|
||||
show_participation_price: boolean,
|
||||
offers: [EventOffer.t()],
|
||||
participation_condition: [EventParticipationCondition.t()]
|
||||
participation_condition: [EventParticipationCondition.t()],
|
||||
show_start_time: boolean,
|
||||
show_end_time: boolean
|
||||
}
|
||||
|
||||
@attrs [
|
||||
@@ -32,7 +34,9 @@ defmodule Mobilizon.Events.EventOptions do
|
||||
:attendees,
|
||||
:program,
|
||||
:comment_moderation,
|
||||
:show_participation_price
|
||||
:show_participation_price,
|
||||
:show_start_time,
|
||||
:show_end_time
|
||||
]
|
||||
|
||||
@primary_key false
|
||||
@@ -45,6 +49,8 @@ defmodule Mobilizon.Events.EventOptions do
|
||||
field(:program, :string)
|
||||
field(:comment_moderation, CommentModeration)
|
||||
field(:show_participation_price, :boolean)
|
||||
field(:show_start_time, :boolean)
|
||||
field(:show_end_time, :boolean)
|
||||
|
||||
embeds_many(:offers, EventOffer)
|
||||
embeds_many(:participation_condition, EventParticipationCondition)
|
||||
|
||||
@@ -181,6 +181,9 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
field(:show_participation_price, :boolean,
|
||||
description: "Whether or not to show the participation price"
|
||||
)
|
||||
|
||||
field(:show_start_time, :boolean, description: "Show event start time")
|
||||
field(:show_end_time, :boolean, description: "Show event end time")
|
||||
end
|
||||
|
||||
input_object :event_options_input do
|
||||
@@ -214,6 +217,9 @@ defmodule MobilizonWeb.Schema.EventType do
|
||||
field(:show_participation_price, :boolean,
|
||||
description: "Whether or not to show the participation price"
|
||||
)
|
||||
|
||||
field(:show_start_time, :boolean, description: "Show event start time")
|
||||
field(:show_end_time, :boolean, description: "Show event end time")
|
||||
end
|
||||
|
||||
object :event_queries do
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<%= if MapSet.member?(@changes, :ends_on) do %>
|
||||
<%= if MapSet.member?(@changes, :ends_on) && !is_nil(@event.ends_on) do %>
|
||||
<tr>
|
||||
<td bgcolor="#ffffff" align="left">
|
||||
<%= gettext "Ending of event" %>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<%= gettext "New date and time for start of event: %{begins_on}", begins_on: datetime_to_string(@event.begins_on, @locale) %>
|
||||
<% end %>
|
||||
|
||||
<%= if MapSet.member?(@changes, :ends_on) do %>
|
||||
<%= if MapSet.member?(@changes, :ends_on) && !is_nil(@event.ends_on) do %>
|
||||
<%= gettext "New date and time for ending of event: %{ends_on}", ends_on: datetime_to_string(@event.ends_on, @locale) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ defmodule Mobilizon.Service.ActivityPub.Converter.Event do
|
||||
|> Enum.map(&Utils.camelize/1)
|
||||
|
||||
Enum.reduce(object, %{}, fn {key, value}, acc ->
|
||||
(value && key in keys && Map.put(acc, Utils.underscore(key), value)) ||
|
||||
(!is_nil(value) && key in keys && Map.put(acc, Utils.underscore(key), value)) ||
|
||||
acc
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -346,7 +346,7 @@ defmodule Mobilizon.Service.ActivityPub.Utils do
|
||||
options = Events.EventOptions |> struct(metadata.options) |> Map.from_struct()
|
||||
|
||||
Enum.reduce(options, res, fn {key, value}, acc ->
|
||||
(value && Map.put(acc, camelize(key), value)) ||
|
||||
(!is_nil(value) && Map.put(acc, camelize(key), value)) ||
|
||||
acc
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user