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

Unverified Commit e15fb980 authored by Georg Ehrke's avatar Georg Ehrke Committed by GitHub
Browse files

Stable1.5 backports 1.5.8 (#760)



* fix parsing all-day events with DTSTART only

Signed-off-by: default avatarGeorg Ehrke <developer@georgehrke.com>

* fix handling of events with recurrence exceptions only

Signed-off-by: default avatarGeorg Ehrke <developer@georgehrke.com>

* Escape calendar sharing drop down.

* Escape attendees

* Escape locations
parent d1776c80
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ app.controller('AttendeeController', function($scope, AutoCompletionService) {
				attendee.email.forEach((email) => {
					let displayname;
					if (emailCount === 1) {
						displayname = attendee.name;
						displayname = _.escape(attendee.name);
					} else {
						displayname = t('calendar', '{name} ({email})', {
							name: attendee.name,
+2 −2
Original line number Diff line number Diff line
@@ -266,7 +266,7 @@ app.controller('CalendarListController', ['$scope', '$rootScope', '$window', 'Ha
				// Combine users and groups
				users = users.map(function(item){
					return {
						display: item.label,
						display: _.escape(item.label),
						displayname: item.label,
						type: constants.SHARE_TYPE_USER,
						identifier: item.value.shareWith
@@ -275,7 +275,7 @@ app.controller('CalendarListController', ['$scope', '$rootScope', '$window', 'Ha

				groups = groups.map(function(item){
					return {
						display: item.label + ' (' + t('calendar', 'group') + ')',
						display: _.escape(item.label + ' (' + t('calendar', 'group') + ')'),
						displayname: item.label,
						type: constants.SHARE_TYPE_GROUP,
						identifier: item.value.shareWith
+10 −1
Original line number Diff line number Diff line
@@ -284,7 +284,16 @@ app.controller('EditorController', ['$scope', 'TimezoneService', 'AutoCompletion
		 * Everything location
		 */
		$scope.searchLocation = function(value) {
			return AutoCompletionService.searchLocation(value);
			return AutoCompletionService.searchLocation(value).then(function(locations) {
				locations = locations.map(function(location){
					return {
						label: location.label,
						name: _.escape(location.name)
					};
				});

				return locations;
			});
		};

		$scope.selectLocationFromTypeahead = function(item) {
+4 −0
Original line number Diff line number Diff line
@@ -378,6 +378,10 @@ app.factory('SimpleEvent', function () {
				dtend.addDuration(vevent.getFirstPropertyValue('duration'));
			} else {
				dtend = dtstart.clone();

				if (dtend.icaltype === 'date') {
					dtend.addDuration(ICAL.Duration.fromString('P1D'));
				}
			}

			data.dtstart = {
+46 −11
Original line number Diff line number Diff line
@@ -67,7 +67,24 @@ app.factory('VEvent', function(TimezoneService, FcEvent, SimpleEvent, ICalFactor

				return dtstart;
			} else {
				return vevent.getFirstPropertyValue('dtstart').clone();
				/*
				 * RFC 5545 - 3.6.1.
				 *
				 * For cases where a "VEVENT" calendar component
				 * specifies a "DTSTART" property with a DATE value type but no
				 * "DTEND" nor "DURATION" property, the event’s duration is taken to
				 * be one day.  For cases where a "VEVENT" calendar component
				 * specifies a "DTSTART" property with a DATE-TIME value type but no
				 * "DTEND" property, the event ends on the same calendar date and
				 * time of day specified by the "DTSTART" property.
				 */
				const dtstart = vevent.getFirstPropertyValue('dtstart').clone();

				if (dtstart.icaltype === 'date') {
					dtstart.addDuration(ICAL.Duration.fromString('P1D'));
				}

				return dtstart;
			}
		};

@@ -188,17 +205,21 @@ app.factory('VEvent', function(TimezoneService, FcEvent, SimpleEvent, ICalFactor
					const vevents = context.comp.getAllSubcomponents('vevent');
					const exceptions = vevents.filter((vevent) => vevent.hasProperty('recurrence-id'));
					const vevent = vevents.find((vevent) => !vevent.hasProperty('recurrence-id'));
					const iCalEvent = new ICAL.Event(vevent, {exceptions});

					if (!vevent && exceptions.length === 0) {
						resolve([]);
					}

					// is there a main event that's recurring?
					if (vevent && (vevent.hasProperty('rrule') || vevent.hasProperty('rdate'))) {
						if (!vevent.hasProperty('dtstart')) {
							resolve([]);
						}

						const iCalEvent = new ICAL.Event(vevent, {exceptions});
						const dtstartProp = vevent.getFirstProperty('dtstart');
						const rawDtstart = dtstartProp.getFirstValue('dtstart');
					const rawDtend = context.calculateDTEnd(vevent);

					if (iCalEvent.isRecurring()) {
						const iterator = new ICAL.RecurExpansion({
							component: vevent,
							dtstart: rawDtstart
@@ -222,11 +243,25 @@ app.factory('VEvent', function(TimezoneService, FcEvent, SimpleEvent, ICalFactor
							fcEvents.push(fcEvent);
						}
					} else {
						if (vevent) {
							exceptions.push(vevent);
						}

						exceptions.forEach((singleVEvent) => {
							if (!singleVEvent.hasProperty('dtstart')) {
								return;
							}

							const dtstartProp = singleVEvent.getFirstProperty('dtstart');
							const rawDtstart = dtstartProp.getFirstValue('dtstart');
							const rawDtend = context.calculateDTEnd(singleVEvent);

							const dtstart = context.convertTz(rawDtstart, timezone.jCal);
							const dtend = context.convertTz(rawDtend, timezone.jCal);
						const fcEvent = FcEvent(iface, vevent, dtstart, dtend);
							const fcEvent = FcEvent(iface, singleVEvent, dtstart, dtend);

							fcEvents.push(fcEvent);
						});
					}

					resolve(fcEvents);
Loading