mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-01 15:09:14 +01:00
Summary: Ref T10747. This: - Exports recurring events properly, with RRULE + RECURRENCE-ID. - When exporting a part of an event series, export the whole series to ICS so it is represented faithfully. - Make the subscribable URL for "Export" objects work. Test Plan: - Downloaded the ".ics" for a normal event, imported it into Calendar.app and Google Calendar. - Downloaded the ".ics" for a recurring event, imported it into Calendar.app and Google Calendar. - Defined an ".ics" Export of my events, subscribed to them in Calendar.app. - Edited an event in Phabricator. - Hit {key Command R} in Calendar.app, saw changes. (MAGIC!) - This export included recurring events, which appeared the same way in Calendar.app and Phabricator. - Can't import into Google Calendar from my local install easily since Google's servers can't hit my laptop, but I'll test once we deploy. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10747 Differential Revision: https://secure.phabricator.com/D16679
94 lines
1.9 KiB
PHP
94 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class PhabricatorCalendarExportQuery
|
|
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
|
|
private $ids;
|
|
private $phids;
|
|
private $authorPHIDs;
|
|
private $secretKeys;
|
|
private $isDisabled;
|
|
|
|
public function withIDs(array $ids) {
|
|
$this->ids = $ids;
|
|
return $this;
|
|
}
|
|
|
|
public function withPHIDs(array $phids) {
|
|
$this->phids = $phids;
|
|
return $this;
|
|
}
|
|
|
|
public function withAuthorPHIDs(array $phids) {
|
|
$this->authorPHIDs = $phids;
|
|
return $this;
|
|
}
|
|
|
|
public function withIsDisabled($is_disabled) {
|
|
$this->isDisabled = $is_disabled;
|
|
return $this;
|
|
}
|
|
|
|
public function withSecretKeys(array $keys) {
|
|
$this->secretKeys = $keys;
|
|
return $this;
|
|
}
|
|
|
|
public function newResultObject() {
|
|
return new PhabricatorCalendarExport();
|
|
}
|
|
|
|
protected function loadPage() {
|
|
return $this->loadStandardPage($this->newResultObject());
|
|
}
|
|
|
|
protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
|
|
$where = parent::buildWhereClauseParts($conn);
|
|
|
|
if ($this->ids !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'export.id IN (%Ld)',
|
|
$this->ids);
|
|
}
|
|
|
|
if ($this->phids !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'export.phid IN (%Ls)',
|
|
$this->phids);
|
|
}
|
|
|
|
if ($this->authorPHIDs !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'export.authorPHID IN (%Ls)',
|
|
$this->authorPHIDs);
|
|
}
|
|
|
|
if ($this->isDisabled !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'export.isDisabled = %d',
|
|
(int)$this->isDisabled);
|
|
}
|
|
|
|
if ($this->secretKeys !== null) {
|
|
$where[] = qsprintf(
|
|
$conn,
|
|
'export.secretKey IN (%Ls)',
|
|
$this->secretKeys);
|
|
}
|
|
|
|
return $where;
|
|
}
|
|
|
|
protected function getPrimaryTableAlias() {
|
|
return 'export';
|
|
}
|
|
|
|
public function getQueryApplicationClass() {
|
|
return 'PhabricatorCalendarApplication';
|
|
}
|
|
|
|
}
|