From 52e69bb2a3fba94e51211487f9737c6c5ed90804 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 20 Oct 2021 11:49:55 +0200 Subject: [PATCH 1/4] Fix event options being undefined in event view Signed-off-by: Thomas Citharel --- js/src/views/Event/Event.vue | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/js/src/views/Event/Event.vue b/js/src/views/Event/Event.vue index b30adfeba..48991bdad 100755 --- a/js/src/views/Event/Event.vue +++ b/js/src/views/Event/Event.vue @@ -135,17 +135,17 @@ }" > - + {{ $tc( "{available}/{capacity} available places", - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, { available: - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, - capacity: event.options.maximumAttendeeCapacity, + capacity: maximumAttendeeCapacity, } ) }} @@ -163,17 +163,17 @@ - + {{ $tc( "{available}/{capacity} available places", - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, { available: - event.options.maximumAttendeeCapacity - + maximumAttendeeCapacity - event.participantStats.participant, - capacity: event.options.maximumAttendeeCapacity, + capacity: maximumAttendeeCapacity, } ) }} @@ -1074,20 +1074,23 @@ export default class Event extends EventMixin { : this.event.beginsOn; } + get maximumAttendeeCapacity(): number { + return this.event?.options?.maximumAttendeeCapacity; + } + get eventCapacityOK(): boolean { if (this.event.draft) return true; - if (!this.event.options.maximumAttendeeCapacity) return true; + if (!this.maximumAttendeeCapacity) return true; return ( - this.event.options.maximumAttendeeCapacity > + this.event?.options?.maximumAttendeeCapacity > this.event.participantStats.participant ); } get numberOfPlacesStillAvailable(): number { - if (this.event.draft) return this.event.options.maximumAttendeeCapacity; + if (this.event.draft) return this.maximumAttendeeCapacity; return ( - this.event.options.maximumAttendeeCapacity - - this.event.participantStats.participant + this.maximumAttendeeCapacity - this.event.participantStats.participant ); } From 3ecc2cbad706159a83c72a5c8692e197522f80af Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 20 Oct 2021 11:50:22 +0200 Subject: [PATCH 2/4] Fix group profile being inaccessible Signed-off-by: Thomas Citharel --- lib/graphql/resolvers/discussion.ex | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/graphql/resolvers/discussion.ex b/lib/graphql/resolvers/discussion.ex index d42e5c135..b7ca8e51a 100644 --- a/lib/graphql/resolvers/discussion.ex +++ b/lib/graphql/resolvers/discussion.ex @@ -32,16 +32,10 @@ defmodule Mobilizon.GraphQL.Resolvers.Discussion do end end - def find_discussions_for_actor(%Actor{}, _args, %{ - context: %{ - current_user: %User{} - } - }) do + def find_discussions_for_actor(%Actor{}, _args, _resolution) do {:ok, %Page{total: 0, elements: []}} end - def find_discussions_for_actor(%Actor{}, _args, _resolution), do: {:error, :unauthenticated} - @spec get_discussion(any(), map(), Absinthe.Resolution.t()) :: {:ok, Discussion.t()} | {:error, :unauthorized | :discussion_not_found | String.t()} def get_discussion(_parent, %{id: id}, %{ From df22082f3e9573fa95e24a3fbbdf345399a79eb9 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 20 Oct 2021 11:50:39 +0200 Subject: [PATCH 3/4] Fix posts not able to accept existing tags Signed-off-by: Thomas Citharel --- lib/mobilizon/posts/post.ex | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/mobilizon/posts/post.ex b/lib/mobilizon/posts/post.ex index a19693716..789a7a95e 100644 --- a/lib/mobilizon/posts/post.ex +++ b/lib/mobilizon/posts/post.ex @@ -22,8 +22,8 @@ defmodule Mobilizon.Posts.Post do import Ecto.Changeset alias Ecto.Changeset alias Mobilizon.Actors.Actor + alias Mobilizon.{Events, Medias} alias Mobilizon.Events.Tag - alias Mobilizon.Medias alias Mobilizon.Medias.Media alias Mobilizon.Posts.Post.TitleSlug alias Mobilizon.Posts.PostVisibility @@ -141,6 +141,12 @@ defmodule Mobilizon.Posts.Post do defp put_tags(changeset, _), do: changeset + @spec process_tag(map() | Tag.t()) :: Tag.t() | Ecto.Changeset.t() + # We need a changeset instead of a raw struct because of slug which is generated in changeset + defp process_tag(%{id: id} = _tag) do + Events.get_tag(id) + end + defp process_tag(tag), do: Tag.changeset(%Tag{}, tag) defp maybe_put_publish_date(%Changeset{} = changeset) do From 70b4fd5f6ef4ef3a7b6bbda8f1822ecc00714314 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 20 Oct 2021 12:37:28 +0200 Subject: [PATCH 4/4] Ignore demo folder Signed-off-by: Thomas Citharel --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9f6650b4b..5e1d85557 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,5 @@ release/ docker/production/.env test-junit-report.xml js/junit.xml -.env \ No newline at end of file +.env +demo/