@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+16 -8
+3
src/applications/calendar/controller/PhabricatorCalendarExportICSController.php
··· 82 82 $saved->setParameter('rangeEnd', null); 83 83 $saved->setParameter('upcoming', null); 84 84 85 + // The "month" and "day" display modes imply time ranges. 86 + $saved->setParameter('display', 'list'); 87 + 85 88 $query = $engine->buildQueryFromSavedQuery($saved); 86 89 87 90 $events = $query
-1
src/applications/calendar/query/PhabricatorCalendarEventQuery.php
··· 172 172 } 173 173 174 174 $raw_limit = $this->getRawResultLimit(); 175 - 176 175 if (!$raw_limit && !$this->rangeEnd) { 177 176 throw new Exception( 178 177 pht(
+13 -7
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 82 82 ); 83 83 } 84 84 85 + public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 86 + $query = parent::buildQueryFromSavedQuery($saved); 87 + 88 + // If this is an export query for generating an ".ics" file, don't 89 + // build ghost events. 90 + if ($saved->getParameter('export')) { 91 + $query->setGenerateGhosts(false); 92 + } 93 + 94 + return $query; 95 + } 96 + 85 97 protected function buildQueryFromParameters(array $map) { 86 98 $query = $this->newQuery(); 87 99 $viewer = $this->requireViewer(); ··· 125 137 $query->withImportSourcePHIDs($map['importSourcePHIDs']); 126 138 } 127 139 128 - // Generate ghosts (and ignore stub events) if we aren't querying for 129 - // specific events or exporting. 130 - if (!empty($map['export'])) { 131 - // This is a specific mode enabled by event exports. 132 - $query 133 - ->withIsStub(false); 134 - } else if (!$map['ids'] && !$map['phids']) { 140 + if (!$map['ids'] && !$map['phids']) { 135 141 $query 136 142 ->withIsStub(false) 137 143 ->setGenerateGhosts(true);