Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 69cb006e authored by Christoph Wurst's avatar Christoph Wurst Committed by GitHub
Browse files

Merge pull request #3427 from nextcloud/backport/3335/stable2.3

[stable2.3] Fix new events disappearing from the grid
parents b3427416 6b94b4d0
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ export default {
				lazyFetching: false,
				nowIndicator: true,
				progressiveEventRendering: true,
				unselectAuto: true,
				unselectAuto: false,
				// Timezones:
				timeZone: this.timezoneId,
			}
@@ -203,7 +203,7 @@ export default {
			resizeObserver.observe(this.$refs.fullCalendar.$el)
		}
	},
	created() {
	async created() {
		this.updateTodayJob = setInterval(() => {
			const newDate = getYYYYMMDDFromFirstdayParam('now')

@@ -244,6 +244,22 @@ export default {

			next()
		})

		// Trigger the select event programmatically on initial page load to show the new event
		// in the grid. Wait for the next tick because the ref isn't available right away.
		await this.$nextTick()
		if (['NewPopoverView', 'NewSidebarView'].includes(this.$route.name)) {
			const start = new Date(parseInt(this.$route.params.dtstart) * 1000)
			const end = new Date(parseInt(this.$route.params.dtend) * 1000)
			if (!isNaN(start.getTime()) && !isNaN(end.getTime())) {
				const calendarApi = this.$refs.fullCalendar.getApi()
				calendarApi.select({
					start,
					end,
					allDay: this.$route.params.allDay === '1',
				})
			}
		}
	},
	methods: {
		/**
+13 −23
Original line number Diff line number Diff line
<!--
  - @copyright Copyright (c) 2019 Georg Ehrke <oc.list@georgehrke.com>
  - @author Georg Ehrke <oc.list@georgehrke.com>
  - @author Richard Steinmetz <richard@steinmetz.cloud>
  -
  - @license GNU AGPL version 3 or any later version
  -
@@ -22,7 +23,7 @@
<template>
	<Popover
		ref="popover"
		:open="true"
		:open="isVisible"
		:auto-hide="false"
		:placement="placement"
		:boundaries-element="boundaryElement"
@@ -165,17 +166,20 @@ export default {
			hasLocation: false,
			hasDescription: false,
			boundaryElement: document.querySelector('#app-content > .fc'),
			isVisible: true,
		}
	},
	watch: {
		eventComponent() {
			const isNew = this.$route.name === 'NewPopoverView'
			this.$refs.popover
				.$children[0]
				.$refs.trigger = this.getDomElementForPopover(isNew, this.$route)
			this.$refs.popover
				.$children[0]
				.$_restartPopper()
		$route(to, from) {
			// Update the popover position by updating its reference element.
			const isNew = to.name === 'NewPopoverView'
			const popover = this.$refs.popover.$children[0]
			popover.$_updatePopper(() => {
				popover.popperInstance.reference = this.getDomElementForPopover(isNew, to)
			})

			// Hide popover when changing the view until the user selects a slot again
			this.isVisible = to.params.view === from.params.view
		},
		calendarObjectInstance() {
			this.hasLocation = false
@@ -193,15 +197,12 @@ export default {
		this.$nextTick(() => {
			const isNew = this.$route.name === 'NewPopoverView'

			// TODO: test beforeRouteUpdate

			// V3 of V-Tooltip will have a prop to define the reference element for popper.js
			// For now we have to stick to this ugly hack
			// https://github.com/Akryum/v-tooltip/issues/60
			this.$refs.popover
				.$children[0]
				.$refs.trigger = this.getDomElementForPopover(isNew, this.$route)
			this.isVisible = true
		})
	},
	methods: {
@@ -250,16 +251,5 @@ export default {
			return matchingDomObject
		},
	},
	beforeRouteUpdate(to, from, next) {
		const isNew = to.name === 'NewPopoverView'
		this.$refs.popover
			.$children[0]
			.$refs.trigger = this.getDomElementForPopover(isNew, to)
		this.$refs.popover
			.$children[0]
			.$_restartPopper()

		next()
	},
}
</script>