Merge branch 'LeoMouyna/mobilizon-307-fix-limited-places-switch-behaviour' into 'master'

Leo mouyna/mobilizon 307 fix limited places switch behaviour

See merge request framasoft/mobilizon!347
This commit is contained in:
Thomas Citharel 2019-12-15 23:12:41 +01:00
commit abeb11d18d
3 changed files with 19 additions and 6 deletions

View file

@ -1,11 +1,11 @@
FROM elixir:latest FROM elixir:latest
LABEL maintainer="Thomas Citharel <tcit@tcit.fr>" LABEL maintainer="Thomas Citharel <tcit@tcit.fr>"
ENV REFRESHED_AT=2019-10-06 ENV REFRESHED_AT=2019-12-15
RUN apt-get update -yq && apt-get install -yq build-essential inotify-tools postgresql-client git curl gnupg xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 python3-pip RUN apt-get update -yq && apt-get install -yq build-essential inotify-tools postgresql-client git curl gnupg xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 python3-pip
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash && apt-get install nodejs -yq RUN curl -sL https://deb.nodesource.com/setup_10.x | bash && apt-get install nodejs -yq
RUN npm install -g yarn wait-on RUN npm install -g yarn wait-on
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mix local.hex --force && mix local.rebar --force RUN mix local.hex --force && mix local.rebar --force
RUN pip3 install mkdocs mkdocs-material pymdown-extensions pygments mkdocs-git-revision-date-plugin RUN pip3 install mkdocs mkdocs-material pymdown-extensions pygments mkdocs-git-revision-date-localized-plugin
RUN curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb /usr/share/GeoIP/GeoLite2-City.mmdb RUN curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mkdir -p /usr/share/GeoIP && mv GeoLite2-City_*/GeoLite2-City.mmdb /usr/share/GeoIP/GeoLite2-City.mmdb

View file

@ -92,7 +92,7 @@
<div class="box" v-if="limitedPlaces"> <div class="box" v-if="limitedPlaces">
<b-field :label="$t('Number of places')"> <b-field :label="$t('Number of places')">
<b-numberinput controls-position="compact" min="0" v-model="event.options.maximumAttendeeCapacity" /> <b-numberinput controls-position="compact" min="1" v-model="event.options.maximumAttendeeCapacity" />
</b-field> </b-field>
<!-- <!--
<b-field> <b-field>
@ -289,6 +289,8 @@ import IdentityPickerWrapper from '@/views/Account/IdentityPickerWrapper.vue';
import { RouteName } from '@/router'; import { RouteName } from '@/router';
import 'intersection-observer'; import 'intersection-observer';
const DEFAULT_LIMIT_NUMBER_OF_PLACES = 10;
@Component({ @Component({
components: { IdentityPickerWrapper, AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor: EditorComponent }, components: { IdentityPickerWrapper, AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor: EditorComponent },
apollo: { apollo: {
@ -344,7 +346,7 @@ export default class EditEvent extends Vue {
this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON())); this.unmodifiedEvent = JSON.parse(JSON.stringify(this.event.toEditJSON()));
this.pictureFile = await buildFileFromIPicture(this.event.picture); this.pictureFile = await buildFileFromIPicture(this.event.picture);
this.limitedPlaces = this.event.options.maximumAttendeeCapacity !== 0; this.limitedPlaces = this.event.options.maximumAttendeeCapacity > 0;
} }
} }
@ -574,6 +576,17 @@ export default class EditEvent extends Vue {
return new EventModel(result.data.event); return new EventModel(result.data.event);
} }
@Watch('limitedPlaces')
updatedEventCapacityOptions(limitedPlaces: boolean) {
if (!limitedPlaces) {
this.event.options.maximumAttendeeCapacity = 0;
this.event.options.remainingAttendeeCapacity = 0;
this.event.options.showRemainingAttendeeCapacity = false;
} else {
this.event.options.maximumAttendeeCapacity = this.event.options.maximumAttendeeCapacity || DEFAULT_LIMIT_NUMBER_OF_PLACES;
}
}
@Watch('needsApproval') @Watch('needsApproval')
updateEventJoinOptions(needsApproval) { updateEventJoinOptions(needsApproval) {
if (needsApproval === true) { if (needsApproval === true) {

View file

@ -63,7 +63,7 @@ export default class SendPasswordReset extends Vue {
} }
removeError(message: string) { removeError(message: string) {
this.errors.splice(this.errors.indexOf(message)) this.errors.splice(this.errors.indexOf(message));
} }
async sendResetPasswordTokenAction(e) { async sendResetPasswordTokenAction(e) {
@ -81,7 +81,7 @@ export default class SendPasswordReset extends Vue {
} catch (err) { } catch (err) {
console.error(err); console.error(err);
err.graphQLErrors.forEach(({ message }) => { err.graphQLErrors.forEach(({ message }) => {
if (this.errors.indexOf(message) < 0){ if (this.errors.indexOf(message) < 0) {
this.errors.push(message); this.errors.push(message);
} }
}); });