diff --git a/src/applications/calendar/controller/PhabricatorCalendarExportICSController.php b/src/applications/calendar/controller/PhabricatorCalendarExportICSController.php index a1264693bd..0bb409c0ba 100644 --- a/src/applications/calendar/controller/PhabricatorCalendarExportICSController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarExportICSController.php @@ -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 diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php index a8d1ccdc1b..bf1d9b43e2 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php @@ -172,7 +172,6 @@ final class PhabricatorCalendarEventQuery } $raw_limit = $this->getRawResultLimit(); - if (!$raw_limit && !$this->rangeEnd) { throw new Exception( pht( diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index 704f161e3e..05d4eadb16 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -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);