mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fix some minor Calendar issues, including a paging issue on imports
Summary: Fixes T11808. I couldn't reproduce the issue there locally so I'm just cheating a little bit until a better reproduction case shows up. We don't need to do a full load here anyway, and testing for any row is more efficient. Test Plan: Poked around imports without issues, but couldn't reproduce this problem locally. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11808 Differential Revision: https://secure.phabricator.com/D16787
This commit is contained in:
parent
3e15e0b980
commit
191b9398a5
3 changed files with 18 additions and 9 deletions
|
@ -225,6 +225,7 @@ abstract class PhabricatorCalendarImportEngine
|
|||
$xactions[$full_uid] = $this->newUpdateTransactions($event, $node);
|
||||
$update_map[$full_uid] = $event;
|
||||
|
||||
$attendee_map[$full_uid] = array();
|
||||
$attendees = $node->getAttendees();
|
||||
$private_index = 1;
|
||||
foreach ($attendees as $attendee) {
|
||||
|
@ -526,7 +527,7 @@ abstract class PhabricatorCalendarImportEngine
|
|||
->setStartDateTime($start_datetime)
|
||||
->setEndDateTime($end_datetime);
|
||||
|
||||
$event->setIsAllDay($start_datetime->getIsAllDay());
|
||||
$event->setIsAllDay((int)$start_datetime->getIsAllDay());
|
||||
|
||||
// TODO: This should be transactional, but the transaction only accepts
|
||||
// simple frequency rules right now.
|
||||
|
@ -551,11 +552,18 @@ abstract class PhabricatorCalendarImportEngine
|
|||
PhabricatorUser $viewer,
|
||||
PhabricatorCalendarImport $import) {
|
||||
|
||||
$any_event = id(new PhabricatorCalendarEventQuery())
|
||||
->setViewer($viewer)
|
||||
->withImportSourcePHIDs(array($import->getPHID()))
|
||||
->setLimit(1)
|
||||
->execute();
|
||||
$table = new PhabricatorCalendarEvent();
|
||||
$conn = $table->establishConnection('r');
|
||||
|
||||
// Using a CalendarEventQuery here was failing oddly in a way that was
|
||||
// difficult to reproduce locally (see T11808). Just check the table
|
||||
// directly; this is significantly more efficient anyway.
|
||||
|
||||
$any_event = queryfx_all(
|
||||
$conn,
|
||||
'SELECT phid FROM %T WHERE importSourcePHID = %s LIMIT 1',
|
||||
$table->getTableName(),
|
||||
$import->getPHID());
|
||||
|
||||
return (bool)$any_event;
|
||||
}
|
||||
|
|
|
@ -155,8 +155,9 @@ final class PhabricatorCalendarNotificationEngine
|
|||
$sent_map[$event_phid][$target_phid][$initial_epoch] = $row;
|
||||
}
|
||||
|
||||
$notify_min = $cursor;
|
||||
$notify_max = $cursor + $this->getNotifyWindow();
|
||||
$now = PhabricatorTime::getNow();
|
||||
$notify_min = $now;
|
||||
$notify_max = $now + $this->getNotifyWindow();
|
||||
$notify_map = array();
|
||||
foreach ($events as $key => $event) {
|
||||
$initial_epoch = $event->getUTCInitialEpoch();
|
||||
|
|
|
@ -126,7 +126,7 @@ final class PhabricatorCalendarEventQuery
|
|||
return array(
|
||||
'start' => array(
|
||||
'table' => $this->getPrimaryTableAlias(),
|
||||
'column' => 'dateFrom',
|
||||
'column' => 'utcInitialEpoch',
|
||||
'reverse' => true,
|
||||
'type' => 'int',
|
||||
'unique' => false,
|
||||
|
|
Loading…
Reference in a new issue