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(:hide_number_of_participants, :boolean,
|
||||
description: "Whether or not the number of participants is hidden"
|
||||
)
|
||||
|
||||
field(:participant_stats, :participant_stats,
|
||||
description: "Statistics on the event",
|
||||
resolve: &Event.stats_participants/3
|
||||
|
@ -450,6 +454,11 @@ defmodule Mobilizon.GraphQL.Schema.EventType do
|
|||
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(: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(:metadata, list_of(:event_metadata_input), description: "The event metadata")
|
||||
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(:language, :string, description: "The event language", default_value: "und")
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ defmodule Mobilizon.Events.Event do
|
|||
title: String.t(),
|
||||
status: atom(),
|
||||
draft: boolean,
|
||||
hide_number_of_participants: boolean,
|
||||
visibility: atom(),
|
||||
join_options: atom(),
|
||||
external_participation_url: String.t(),
|
||||
|
@ -79,6 +80,7 @@ defmodule Mobilizon.Events.Event do
|
|||
:category,
|
||||
:status,
|
||||
:draft,
|
||||
:hide_number_of_participants,
|
||||
:local,
|
||||
:visibility,
|
||||
:join_options,
|
||||
|
@ -105,6 +107,7 @@ defmodule Mobilizon.Events.Event do
|
|||
field(:title, :string)
|
||||
field(:status, EventStatus, default: :confirmed)
|
||||
field(:draft, :boolean, default: false)
|
||||
field(:hide_number_of_participants, :boolean, default: false)
|
||||
field(:visibility, EventVisibility, default: :public)
|
||||
field(:join_options, JoinOptions, default: :free)
|
||||
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">
|
||||
<p
|
||||
class="inline-flex gap-2 ml-auto"
|
||||
v-if="event.joinOptions !== EventJoinOptions.EXTERNAL"
|
||||
v-if="
|
||||
event.joinOptions !== EventJoinOptions.EXTERNAL &&
|
||||
!event.hideNumberOfParticipants
|
||||
"
|
||||
>
|
||||
<TicketConfirmationOutline />
|
||||
<router-link
|
||||
|
|
|
@ -24,6 +24,7 @@ const FULL_EVENT_FRAGMENT = gql`
|
|||
joinOptions
|
||||
externalParticipationUrl
|
||||
draft
|
||||
hideNumberOfParticipants
|
||||
language
|
||||
category
|
||||
picture {
|
||||
|
@ -205,6 +206,7 @@ export const CREATE_EVENT = gql`
|
|||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$hideNumberOfParticipants: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
$onlineAddress: String
|
||||
|
@ -227,6 +229,7 @@ export const CREATE_EVENT = gql`
|
|||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
hideNumberOfParticipants: $hideNumberOfParticipants
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
onlineAddress: $onlineAddress
|
||||
|
@ -255,6 +258,7 @@ export const EDIT_EVENT = gql`
|
|||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$hideNumberOfParticipants: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
$onlineAddress: String
|
||||
|
@ -278,6 +282,7 @@ export const EDIT_EVENT = gql`
|
|||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
hideNumberOfParticipants: $hideNumberOfParticipants
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
onlineAddress: $onlineAddress
|
||||
|
@ -465,6 +470,7 @@ export const FETCH_GROUP_EVENTS = gql`
|
|||
beginsOn
|
||||
status
|
||||
draft
|
||||
hideNumberOfParticipants
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ interface IEventEditJSON {
|
|||
joinOptions: EventJoinOptions;
|
||||
externalParticipationUrl: string | null;
|
||||
draft: boolean;
|
||||
hideNumberOfParticipants: boolean;
|
||||
picture?: IMedia | { mediaId: string } | null;
|
||||
attributedToId: string | null;
|
||||
organizerActorId?: string;
|
||||
|
@ -76,6 +77,7 @@ export interface IEvent {
|
|||
joinOptions: EventJoinOptions;
|
||||
externalParticipationUrl: string | null;
|
||||
draft: boolean;
|
||||
hideNumberOfParticipants: boolean;
|
||||
|
||||
picture: IMedia | null;
|
||||
|
||||
|
@ -142,6 +144,8 @@ export class EventModel implements IEvent {
|
|||
|
||||
draft = true;
|
||||
|
||||
hideNumberOfParticipants = false;
|
||||
|
||||
publishAt = new Date().toISOString();
|
||||
|
||||
language = "und";
|
||||
|
@ -207,6 +211,7 @@ export class EventModel implements IEvent {
|
|||
this.joinOptions = hash.joinOptions;
|
||||
this.externalParticipationUrl = hash.externalParticipationUrl;
|
||||
this.draft = hash.draft;
|
||||
this.hideNumberOfParticipants = hash.hideNumberOfParticipants;
|
||||
|
||||
this.picture = hash.picture;
|
||||
|
||||
|
@ -259,6 +264,7 @@ export function toEditJSON(event: IEditableEvent): IEventEditJSON {
|
|||
joinOptions: event.joinOptions,
|
||||
externalParticipationUrl: event.externalParticipationUrl,
|
||||
draft: event.draft,
|
||||
hideNumberOfParticipants: event.hideNumberOfParticipants,
|
||||
tags: event.tags.map((t) => t.title),
|
||||
onlineAddress: event.onlineAddress,
|
||||
phoneAddress: event.phoneAddress,
|
||||
|
|
|
@ -295,8 +295,15 @@
|
|||
</o-field>
|
||||
|
||||
<o-field :label="t('Number of places')" v-show="!externalParticipation">
|
||||
<o-switch v-model="limitedPlaces">{{
|
||||
t("Limited number of places")
|
||||
<o-switch>{{ t("Limited number of places") }}</o-switch>
|
||||
</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-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> => {
|
||||
return event.value.title.length > 80
|
||||
? ["info", t("The event title will be ellipsed.")]
|
||||
|
|
Loading…
Reference in New Issue