Add hide_number_of_participants feature
This commit is contained in:
parent
a78dc261e5
commit
94b96b56cf
|
@ -75,6 +75,10 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||||
|
|
||||||
field(:draft, :boolean, description: "Whether or not the event is a draft")
|
field(:draft, :boolean, description: "Whether or not the event is a draft")
|
||||||
|
|
||||||
|
field(:hide_number_of_participants, :boolean,
|
||||||
|
description: "Whether or not the number of participants is hidden"
|
||||||
|
)
|
||||||
|
|
||||||
field(:participant_stats, :participant_stats,
|
field(:participant_stats, :participant_stats,
|
||||||
description: "Statistics on the event",
|
description: "Statistics on the event",
|
||||||
resolve: &Event.stats_participants/3
|
resolve: &Event.stats_participants/3
|
||||||
|
@ -450,6 +454,11 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||||
description: "Whether or not the event is a draft"
|
description: "Whether or not the event is a draft"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
arg(:hide_number_of_participants, :boolean,
|
||||||
|
default_value: false,
|
||||||
|
description: "Whether or not the number of participants is hidden"
|
||||||
|
)
|
||||||
|
|
||||||
arg(:contacts, list_of(:contact), default_value: [], description: "The events contacts")
|
arg(:contacts, list_of(:contact), default_value: [], description: "The events contacts")
|
||||||
arg(:language, :string, description: "The event language", default_value: "und")
|
arg(:language, :string, description: "The event language", default_value: "und")
|
||||||
|
|
||||||
|
@ -507,6 +516,11 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
||||||
arg(:options, :event_options_input, description: "The event options")
|
arg(:options, :event_options_input, description: "The event options")
|
||||||
arg(:metadata, list_of(:event_metadata_input), description: "The event metadata")
|
arg(:metadata, list_of(:event_metadata_input), description: "The event metadata")
|
||||||
arg(:draft, :boolean, description: "Whether or not the event is a draft")
|
arg(:draft, :boolean, description: "Whether or not the event is a draft")
|
||||||
|
|
||||||
|
arg(:hide_number_of_participants, :boolean,
|
||||||
|
description: "Whether or not the number of participants is hidden"
|
||||||
|
)
|
||||||
|
|
||||||
arg(:contacts, list_of(:contact), default_value: [], description: "The events contacts")
|
arg(:contacts, list_of(:contact), default_value: [], description: "The events contacts")
|
||||||
arg(:language, :string, description: "The event language", default_value: "und")
|
arg(:language, :string, description: "The event language", default_value: "und")
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,7 @@ defmodule Mobilizon.Events.Event do
|
||||||
title: String.t(),
|
title: String.t(),
|
||||||
status: atom(),
|
status: atom(),
|
||||||
draft: boolean,
|
draft: boolean,
|
||||||
|
hide_number_of_participants: boolean,
|
||||||
visibility: atom(),
|
visibility: atom(),
|
||||||
join_options: atom(),
|
join_options: atom(),
|
||||||
external_participation_url: String.t(),
|
external_participation_url: String.t(),
|
||||||
|
@ -79,6 +80,7 @@ defmodule Mobilizon.Events.Event do
|
||||||
:category,
|
:category,
|
||||||
:status,
|
:status,
|
||||||
:draft,
|
:draft,
|
||||||
|
:hide_number_of_participants,
|
||||||
:local,
|
:local,
|
||||||
:visibility,
|
:visibility,
|
||||||
:join_options,
|
:join_options,
|
||||||
|
@ -105,6 +107,7 @@ defmodule Mobilizon.Events.Event do
|
||||||
field(:title, :string)
|
field(:title, :string)
|
||||||
field(:status, EventStatus, default: :confirmed)
|
field(:status, EventStatus, default: :confirmed)
|
||||||
field(:draft, :boolean, default: false)
|
field(:draft, :boolean, default: false)
|
||||||
|
field(:hide_number_of_participants, :boolean, default: false)
|
||||||
field(:visibility, EventVisibility, default: :public)
|
field(:visibility, EventVisibility, default: :public)
|
||||||
field(:join_options, JoinOptions, default: :free)
|
field(:join_options, JoinOptions, default: :free)
|
||||||
field(:external_participation_url, :string)
|
field(:external_participation_url, :string)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
defmodule Mobilizon.Storage.Repo.Migrations.AddHideNumberOfParticipantsToEvents do
|
||||||
|
use Ecto.Migration
|
||||||
|
|
||||||
|
def change do
|
||||||
|
alter table(:events) do
|
||||||
|
add(:hide_number_of_participants, :boolean, default: false, null: false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -23,7 +23,10 @@
|
||||||
<div class="flex flex-col gap-1 mt-1">
|
<div class="flex flex-col gap-1 mt-1">
|
||||||
<p
|
<p
|
||||||
class="inline-flex gap-2 ml-auto"
|
class="inline-flex gap-2 ml-auto"
|
||||||
v-if="event.joinOptions !== EventJoinOptions.EXTERNAL"
|
v-if="
|
||||||
|
event.joinOptions !== EventJoinOptions.EXTERNAL &&
|
||||||
|
!event.hideNumberOfParticipants
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<TicketConfirmationOutline />
|
<TicketConfirmationOutline />
|
||||||
<router-link
|
<router-link
|
||||||
|
|
|
@ -24,6 +24,7 @@ const FULL_EVENT_FRAGMENT = gql`
|
||||||
joinOptions
|
joinOptions
|
||||||
externalParticipationUrl
|
externalParticipationUrl
|
||||||
draft
|
draft
|
||||||
|
hideNumberOfParticipants
|
||||||
language
|
language
|
||||||
category
|
category
|
||||||
picture {
|
picture {
|
||||||
|
@ -205,6 +206,7 @@ export const CREATE_EVENT = gql`
|
||||||
$joinOptions: EventJoinOptions
|
$joinOptions: EventJoinOptions
|
||||||
$externalParticipationUrl: String
|
$externalParticipationUrl: String
|
||||||
$draft: Boolean
|
$draft: Boolean
|
||||||
|
$hideNumberOfParticipants: Boolean
|
||||||
$tags: [String]
|
$tags: [String]
|
||||||
$picture: MediaInput
|
$picture: MediaInput
|
||||||
$onlineAddress: String
|
$onlineAddress: String
|
||||||
|
@ -227,6 +229,7 @@ export const CREATE_EVENT = gql`
|
||||||
joinOptions: $joinOptions
|
joinOptions: $joinOptions
|
||||||
externalParticipationUrl: $externalParticipationUrl
|
externalParticipationUrl: $externalParticipationUrl
|
||||||
draft: $draft
|
draft: $draft
|
||||||
|
hideNumberOfParticipants: $hideNumberOfParticipants
|
||||||
tags: $tags
|
tags: $tags
|
||||||
picture: $picture
|
picture: $picture
|
||||||
onlineAddress: $onlineAddress
|
onlineAddress: $onlineAddress
|
||||||
|
@ -255,6 +258,7 @@ export const EDIT_EVENT = gql`
|
||||||
$joinOptions: EventJoinOptions
|
$joinOptions: EventJoinOptions
|
||||||
$externalParticipationUrl: String
|
$externalParticipationUrl: String
|
||||||
$draft: Boolean
|
$draft: Boolean
|
||||||
|
$hideNumberOfParticipants: Boolean
|
||||||
$tags: [String]
|
$tags: [String]
|
||||||
$picture: MediaInput
|
$picture: MediaInput
|
||||||
$onlineAddress: String
|
$onlineAddress: String
|
||||||
|
@ -278,6 +282,7 @@ export const EDIT_EVENT = gql`
|
||||||
joinOptions: $joinOptions
|
joinOptions: $joinOptions
|
||||||
externalParticipationUrl: $externalParticipationUrl
|
externalParticipationUrl: $externalParticipationUrl
|
||||||
draft: $draft
|
draft: $draft
|
||||||
|
hideNumberOfParticipants: $hideNumberOfParticipants
|
||||||
tags: $tags
|
tags: $tags
|
||||||
picture: $picture
|
picture: $picture
|
||||||
onlineAddress: $onlineAddress
|
onlineAddress: $onlineAddress
|
||||||
|
@ -465,6 +470,7 @@ export const FETCH_GROUP_EVENTS = gql`
|
||||||
beginsOn
|
beginsOn
|
||||||
status
|
status
|
||||||
draft
|
draft
|
||||||
|
hideNumberOfParticipants
|
||||||
options {
|
options {
|
||||||
...EventOptions
|
...EventOptions
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ interface IEventEditJSON {
|
||||||
joinOptions: EventJoinOptions;
|
joinOptions: EventJoinOptions;
|
||||||
externalParticipationUrl: string | null;
|
externalParticipationUrl: string | null;
|
||||||
draft: boolean;
|
draft: boolean;
|
||||||
|
hideNumberOfParticipants: boolean;
|
||||||
picture?: IMedia | { mediaId: string } | null;
|
picture?: IMedia | { mediaId: string } | null;
|
||||||
attributedToId: string | null;
|
attributedToId: string | null;
|
||||||
organizerActorId?: string;
|
organizerActorId?: string;
|
||||||
|
@ -76,6 +77,7 @@ export interface IEvent {
|
||||||
joinOptions: EventJoinOptions;
|
joinOptions: EventJoinOptions;
|
||||||
externalParticipationUrl: string | null;
|
externalParticipationUrl: string | null;
|
||||||
draft: boolean;
|
draft: boolean;
|
||||||
|
hideNumberOfParticipants: boolean;
|
||||||
|
|
||||||
picture: IMedia | null;
|
picture: IMedia | null;
|
||||||
|
|
||||||
|
@ -142,6 +144,8 @@ export class EventModel implements IEvent {
|
||||||
|
|
||||||
draft = true;
|
draft = true;
|
||||||
|
|
||||||
|
hideNumberOfParticipants = false;
|
||||||
|
|
||||||
publishAt = new Date().toISOString();
|
publishAt = new Date().toISOString();
|
||||||
|
|
||||||
language = "und";
|
language = "und";
|
||||||
|
@ -207,6 +211,7 @@ export class EventModel implements IEvent {
|
||||||
this.joinOptions = hash.joinOptions;
|
this.joinOptions = hash.joinOptions;
|
||||||
this.externalParticipationUrl = hash.externalParticipationUrl;
|
this.externalParticipationUrl = hash.externalParticipationUrl;
|
||||||
this.draft = hash.draft;
|
this.draft = hash.draft;
|
||||||
|
this.hideNumberOfParticipants = hash.hideNumberOfParticipants;
|
||||||
|
|
||||||
this.picture = hash.picture;
|
this.picture = hash.picture;
|
||||||
|
|
||||||
|
@ -259,6 +264,7 @@ export function toEditJSON(event: IEditableEvent): IEventEditJSON {
|
||||||
joinOptions: event.joinOptions,
|
joinOptions: event.joinOptions,
|
||||||
externalParticipationUrl: event.externalParticipationUrl,
|
externalParticipationUrl: event.externalParticipationUrl,
|
||||||
draft: event.draft,
|
draft: event.draft,
|
||||||
|
hideNumberOfParticipants: event.hideNumberOfParticipants,
|
||||||
tags: event.tags.map((t) => t.title),
|
tags: event.tags.map((t) => t.title),
|
||||||
onlineAddress: event.onlineAddress,
|
onlineAddress: event.onlineAddress,
|
||||||
phoneAddress: event.phoneAddress,
|
phoneAddress: event.phoneAddress,
|
||||||
|
|
|
@ -295,8 +295,15 @@
|
||||||
</o-field>
|
</o-field>
|
||||||
|
|
||||||
<o-field :label="t('Number of places')" v-show="!externalParticipation">
|
<o-field :label="t('Number of places')" v-show="!externalParticipation">
|
||||||
<o-switch v-model="limitedPlaces">{{
|
<o-switch>{{ t("Limited number of places") }}</o-switch>
|
||||||
t("Limited number of places")
|
</o-field>
|
||||||
|
|
||||||
|
<o-field
|
||||||
|
:label="t('Showing participants')"
|
||||||
|
v-show="!externalParticipation"
|
||||||
|
>
|
||||||
|
<o-switch v-model="hideParticipants">{{
|
||||||
|
t("Hide the number of participants")
|
||||||
}}</o-switch>
|
}}</o-switch>
|
||||||
</o-field>
|
</o-field>
|
||||||
|
|
||||||
|
@ -1091,6 +1098,15 @@ const needsApproval = computed({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const hideParticipants = computed({
|
||||||
|
get(): boolean {
|
||||||
|
return event.value?.hideNumberOfParticipants;
|
||||||
|
},
|
||||||
|
set(value: boolean) {
|
||||||
|
event.value.hideNumberOfParticipants = value;
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const checkTitleLength = computed((): Array<string | undefined> => {
|
const checkTitleLength = computed((): Array<string | undefined> => {
|
||||||
return event.value.title.length > 80
|
return event.value.title.length > 80
|
||||||
? ["info", t("The event title will be ellipsed.")]
|
? ["info", t("The event title will be ellipsed.")]
|
||||||
|
|
Loading…
Reference in New Issue