Fix a couple of calendar export daterange issues
Summary: Ref T11816. In some cases, Calendar would only export a subset of events because the "export" flag was ignored or the "display" parameter applied an improper date range to the query. - Make sure the `export` flag gets processed, even though it isn't a "real" field on the search engine. - Clear the "display" parameter to avoid date range windowing coming from the day/month logic. Test Plan: Exported a "display=month" view, verified future events came with it. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11816 Differential Revision: https://secure.phabricator.com/D16898
This commit is contained in:
		| @@ -82,6 +82,9 @@ final class PhabricatorCalendarExportICSController | ||||
|     $saved->setParameter('rangeEnd', null); | ||||
|     $saved->setParameter('upcoming', null); | ||||
|  | ||||
|     // The "month" and "day" display modes imply time ranges. | ||||
|     $saved->setParameter('display', 'list'); | ||||
|  | ||||
|     $query = $engine->buildQueryFromSavedQuery($saved); | ||||
|  | ||||
|     $events = $query | ||||
|   | ||||
| @@ -172,7 +172,6 @@ final class PhabricatorCalendarEventQuery | ||||
|     } | ||||
|  | ||||
|     $raw_limit = $this->getRawResultLimit(); | ||||
|  | ||||
|     if (!$raw_limit && !$this->rangeEnd) { | ||||
|       throw new Exception( | ||||
|         pht( | ||||
|   | ||||
| @@ -82,6 +82,18 @@ final class PhabricatorCalendarEventSearchEngine | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { | ||||
|     $query = parent::buildQueryFromSavedQuery($saved); | ||||
|  | ||||
|     // If this is an export query for generating an ".ics" file, don't | ||||
|     // build ghost events. | ||||
|     if ($saved->getParameter('export')) { | ||||
|       $query->setGenerateGhosts(false); | ||||
|     } | ||||
|  | ||||
|     return $query; | ||||
|   } | ||||
|  | ||||
|   protected function buildQueryFromParameters(array $map) { | ||||
|     $query = $this->newQuery(); | ||||
|     $viewer = $this->requireViewer(); | ||||
| @@ -125,13 +137,7 @@ final class PhabricatorCalendarEventSearchEngine | ||||
|       $query->withImportSourcePHIDs($map['importSourcePHIDs']); | ||||
|     } | ||||
|  | ||||
|     // Generate ghosts (and ignore stub events) if we aren't querying for | ||||
|     // specific events or exporting. | ||||
|     if (!empty($map['export'])) { | ||||
|       // This is a specific mode enabled by event exports. | ||||
|       $query | ||||
|         ->withIsStub(false); | ||||
|     } else if (!$map['ids'] && !$map['phids']) { | ||||
|     if (!$map['ids'] && !$map['phids']) { | ||||
|       $query | ||||
|         ->withIsStub(false) | ||||
|         ->setGenerateGhosts(true); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 epriestley
					epriestley