Participation fixes
Closes #208 and #210 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
2577a2a27b
commit
57f0b5dad1
@ -1,3 +1,4 @@
|
|||||||
|
import {ParticipantRole} from "@/types/event.model";
|
||||||
<template>
|
<template>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<b-loading :active.sync="$apollo.loading"></b-loading>
|
<b-loading :active.sync="$apollo.loading"></b-loading>
|
||||||
@ -350,7 +351,7 @@ export default class Event extends EventMixin {
|
|||||||
async joinEvent(identity: IPerson) {
|
async joinEvent(identity: IPerson) {
|
||||||
this.isJoinModalActive = false;
|
this.isJoinModalActive = false;
|
||||||
try {
|
try {
|
||||||
await this.$apollo.mutate<{ joinEvent: IParticipant }>({
|
const { data } = await this.$apollo.mutate<{ joinEvent: IParticipant }>({
|
||||||
mutation: JOIN_EVENT,
|
mutation: JOIN_EVENT,
|
||||||
variables: {
|
variables: {
|
||||||
eventId: this.event.id,
|
eventId: this.event.id,
|
||||||
@ -393,6 +394,14 @@ export default class Event extends EventMixin {
|
|||||||
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (data) {
|
||||||
|
this.$buefy.notification.open({
|
||||||
|
message: (data.joinEvent.role === ParticipantRole.NOT_APPROVED ? this.$t('Your participation has been requested') : this.$t('Your participation has been confirmed')) as string,
|
||||||
|
type: 'is-success',
|
||||||
|
position: 'is-bottom-right',
|
||||||
|
duration: 5000,
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@ -412,7 +421,7 @@ export default class Event extends EventMixin {
|
|||||||
|
|
||||||
async leaveEvent() {
|
async leaveEvent() {
|
||||||
try {
|
try {
|
||||||
await this.$apollo.mutate<{ leaveEvent: IParticipant }>({
|
const { data } = await this.$apollo.mutate<{ leaveEvent: IParticipant }>({
|
||||||
mutation: LEAVE_EVENT,
|
mutation: LEAVE_EVENT,
|
||||||
variables: {
|
variables: {
|
||||||
eventId: this.event.id,
|
eventId: this.event.id,
|
||||||
@ -454,6 +463,14 @@ export default class Event extends EventMixin {
|
|||||||
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
store.writeQuery({ query: FETCH_EVENT, variables: { uuid: this.uuid }, data: { event } });
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
if (data) {
|
||||||
|
this.$buefy.notification.open({
|
||||||
|
message: this.$t('You have cancelled your participation') as string,
|
||||||
|
type: 'is-success',
|
||||||
|
position: 'is-bottom-right',
|
||||||
|
duration: 5000,
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
@ -414,10 +414,10 @@ defmodule Mobilizon.Service.ActivityPub do
|
|||||||
def join(%Event{options: options} = event, %Actor{} = actor, local) do
|
def join(%Event{options: options} = event, %Actor{} = actor, local) do
|
||||||
# TODO Refactor me for federation
|
# TODO Refactor me for federation
|
||||||
with maximum_attendee_capacity <-
|
with maximum_attendee_capacity <-
|
||||||
Map.get(options, :maximum_attendee_capacity, 2_000_000) || false,
|
Map.get(options, :maximum_attendee_capacity) || 0,
|
||||||
{:maximum_attendee_capacity, true} <-
|
{:maximum_attendee_capacity, true} <-
|
||||||
{:maximum_attendee_capacity,
|
{:maximum_attendee_capacity,
|
||||||
!maximum_attendee_capacity ||
|
maximum_attendee_capacity == 0 ||
|
||||||
Mobilizon.Events.count_participant_participants(event.id) <
|
Mobilizon.Events.count_participant_participants(event.id) <
|
||||||
maximum_attendee_capacity},
|
maximum_attendee_capacity},
|
||||||
role <- Mobilizon.Events.get_default_participant_role(event),
|
role <- Mobilizon.Events.get_default_participant_role(event),
|
||||||
|
Loading…
Reference in New Issue
Block a user