1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-23 15:22:41 +01:00

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:
epriestley 2016-11-18 09:03:12 -08:00
parent 0033fe6667
commit 132b0803cb
3 changed files with 16 additions and 8 deletions

View file

@ -82,6 +82,9 @@ final class PhabricatorCalendarExportICSController
$saved->setParameter('rangeEnd', null); $saved->setParameter('rangeEnd', null);
$saved->setParameter('upcoming', null); $saved->setParameter('upcoming', null);
// The "month" and "day" display modes imply time ranges.
$saved->setParameter('display', 'list');
$query = $engine->buildQueryFromSavedQuery($saved); $query = $engine->buildQueryFromSavedQuery($saved);
$events = $query $events = $query

View file

@ -172,7 +172,6 @@ final class PhabricatorCalendarEventQuery
} }
$raw_limit = $this->getRawResultLimit(); $raw_limit = $this->getRawResultLimit();
if (!$raw_limit && !$this->rangeEnd) { if (!$raw_limit && !$this->rangeEnd) {
throw new Exception( throw new Exception(
pht( pht(

View file

@ -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) { protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery(); $query = $this->newQuery();
$viewer = $this->requireViewer(); $viewer = $this->requireViewer();
@ -125,13 +137,7 @@ final class PhabricatorCalendarEventSearchEngine
$query->withImportSourcePHIDs($map['importSourcePHIDs']); $query->withImportSourcePHIDs($map['importSourcePHIDs']);
} }
// Generate ghosts (and ignore stub events) if we aren't querying for if (!$map['ids'] && !$map['phids']) {
// 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']) {
$query $query
->withIsStub(false) ->withIsStub(false)
->setGenerateGhosts(true); ->setGenerateGhosts(true);