Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13972743
D12738.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12738.id.diff
View Options
diff --git a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
--- a/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
+++ b/src/applications/calendar/query/PhabricatorCalendarEventQuery.php
@@ -7,7 +7,7 @@
private $phids;
private $rangeBegin;
private $rangeEnd;
- private $invitedPHIDs;
+ private $inviteePHIDs;
private $creatorPHIDs;
private $isCancelled;
@@ -28,7 +28,7 @@
}
public function withInvitedPHIDs(array $phids) {
- $this->invitedPHIDs = $phids;
+ $this->inviteePHIDs = $phids;
return $this;
}
@@ -48,67 +48,79 @@
$data = queryfx_all(
$conn_r,
- 'SELECT * FROM %T %Q %Q %Q',
+ 'SELECT event.* FROM %T event %Q %Q %Q %Q %Q',
$table->getTableName(),
+ $this->buildJoinClause($conn_r),
$this->buildWhereClause($conn_r),
+ $this->buildGroupClause($conn_r),
$this->buildOrderClause($conn_r),
$this->buildLimitClause($conn_r));
return $table->loadAllFromArray($data);
}
+ protected function buildJoinClauseParts(AphrontDatabaseConnection $conn_r) {
+ $parts = parent::buildJoinClauseParts($conn_r);
+ if ($this->inviteePHIDs !== null) {
+ $parts[] = qsprintf(
+ $conn_r,
+ 'JOIN %T invitee ON invitee.eventPHID = event.phid'.
+ 'AND invitee.status != %s',
+ id(new PhabricatorCalendarEventInvitee())->getTableName(),
+ PhabricatorCalendarEventInvitee::STATUS_UNINVITED);
+ }
+ return $parts;
+ }
+
protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
$where = array();
if ($this->ids) {
$where[] = qsprintf(
$conn_r,
- 'id IN (%Ld)',
+ 'event.id IN (%Ld)',
$this->ids);
}
if ($this->phids) {
$where[] = qsprintf(
$conn_r,
- 'phid IN (%Ls)',
+ 'event.phid IN (%Ls)',
$this->phids);
}
if ($this->rangeBegin) {
$where[] = qsprintf(
$conn_r,
- 'dateTo >= %d',
+ 'event.dateTo >= %d',
$this->rangeBegin);
}
if ($this->rangeEnd) {
$where[] = qsprintf(
$conn_r,
- 'dateFrom <= %d',
+ 'event.dateFrom <= %d',
$this->rangeEnd);
}
- // TODO: Currently, the creator is always the only invitee, but you can
- // query them separately since this won't always be true.
-
- if ($this->invitedPHIDs) {
+ if ($this->inviteePHIDs !== null) {
$where[] = qsprintf(
$conn_r,
- 'userPHID IN (%Ls)',
- $this->invitedPHIDs);
+ 'invitee.inviteePHID IN (%Ls)',
+ $this->inviteePHIDs);
}
if ($this->creatorPHIDs) {
$where[] = qsprintf(
$conn_r,
- 'userPHID IN (%Ls)',
+ 'event.userPHID IN (%Ls)',
$this->creatorPHIDs);
}
if ($this->isCancelled !== null) {
$where[] = qsprintf(
$conn_r,
- 'isCancelled = %d',
+ 'event.isCancelled = %d',
(int)$this->isCancelled);
}
@@ -117,6 +129,21 @@
return $this->formatWhereClause($where);
}
+ protected function getPrimaryTableAlias() {
+ return 'event';
+ }
+
+ protected function shouldGroupQueryResultRows() {
+ if ($this->inviteePHIDs !== null) {
+ return true;
+ }
+ return parent::shouldGroupQueryResultRows();
+ }
+
+ protected function getApplicationSearchObjectPHIDColumn() {
+ return 'event.phid';
+ }
+
public function getQueryApplicationClass() {
return 'PhabricatorCalendarApplication';
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 18, 8:59 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6728710
Default Alt Text
D12738.id.diff (3 KB)
Attached To
Mode
D12738: Searching Calendar events by invitee should work now
Attached
Detach File
Event Timeline
Log In to Comment