From 684547cb8bc230ecc73b424c072de8ca434378cb Mon Sep 17 00:00:00 2001 From: sedum Date: Sun, 11 Aug 2024 00:26:09 +0200 Subject: [PATCH] fix: online_locations and hide/show address in edit mode online_locations are not removed, and fix limit via gui to max 3 urls. In edit mode if event is online do not show address field with null value --- components/WhereInput.vue | 23 ++++++++++------------- pages/add/_edit.vue | 4 +++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/components/WhereInput.vue b/components/WhereInput.vue index dfa36c76..f058828c 100644 --- a/components/WhereInput.vue +++ b/components/WhereInput.vue @@ -56,9 +56,7 @@ v-row.mb-4 v-dialog(v-model='whereInputAdvancedDialog' destroy-on-close max-width='700px' :fullscreen='$vuetify.breakpoint.xsOnly' dense) WhereInputAdvanced(ref='whereAdvanced' :place.sync='value' :event='event' - @close='whereInputAdvancedDialog = false && this.$refs.address.blur()' - :onlineLocations.sync="onlineLocations" - @update:onlineLocations="selectLocations") + @close='whereInputAdvancedDialog = false && this.$refs.address.blur()') @@ -90,7 +88,7 @@ export default { computed: { ...mapState(['settings']), isOnLine () { - return this.settings.allow_online_event && this.place.name === 'online' + return this.settings.allow_online_event && this.value.name === 'online' }, showAdvancedDialogButton () { @@ -183,17 +181,16 @@ export default { this.event.online_locations = [] if (this.onlineLocations) { - // Insert up to 3 online location: the main one and 2 fallback - if (this.onlineLocations.length > 3) { - this.$nextTick(() => this.onlineLocations = this.onlineLocations.slice(0, 3)) - } - // Remove duplicates - this.$nextTick(() => this.onlineLocations = [...new Set(this.onlineLocations)]) - this.onlineLocations.forEach((item, i) => { - if (!item.startsWith('http')) { this.onlineLocations[i] = `https://${item}` } - this.event.online_locations[i] = this.onlineLocations[i] + if (!item.startsWith('http')) { item = `https://${item}` } + this.onlineLocations[i] = item }) + // Remove duplicates + this.onlineLocations = [...new Set(this.onlineLocations)] + // Insert up to 3 online location: the main one and 2 fallback + this.onlineLocations = this.onlineLocations.slice(0, 3) + + this.event.online_locations = this.onlineLocations } }, } diff --git a/pages/add/_edit.vue b/pages/add/_edit.vue index 740af0ec..649e6c49 100644 --- a/pages/add/_edit.vue +++ b/pages/add/_edit.vue @@ -244,8 +244,10 @@ export default { formData.append('place_longitude', this.event.place.longitude || '') } - if (this.event.online_locations) { + if (this.event.online_locations.length) { this.event.online_locations.forEach(l => formData.append('online_locations[]', l)) + } else { + formData.append('online_locations', []) } formData.append('description', this.event.description)