diff --git a/resources/sql/autopatches/20150506.calendarunnamedevents.1.php b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20150506.calendarunnamedevents.1.php @@ -0,0 +1,33 @@ +establishConnection('w'); +$iterator = new LiskMigrationIterator($table); +foreach ($iterator as $event) { + $id = $event->getID(); + + if (strlen($event->getName()) == 0) { + echo "Renaming event {$id}...\n"; + $viewer = PhabricatorUser::getOmnipotentUser(); + $handle = id(new PhabricatorHandleQuery()) + ->setViewer($viewer) + ->withPHIDs(array($event->getUserPHID())) + ->executeOne(); + if ($handle->isComplete()) { + $new_name = $handle->getName(); + } else { + $new_name = pht('Unnamed Event'); + } + + queryfx( + $conn_w, + 'UPDATE %T SET name = %s WHERE id = %d', + $table->getTableName(), + $new_name, + $id); + } +} + +echo "Done.\n"; diff --git a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php --- a/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php +++ b/src/applications/calendar/controller/PhabricatorCalendarEventViewController.php @@ -76,7 +76,7 @@ $is_cancelled = $event->getIsCancelled(); $icon = $is_cancelled ? ('fa-times') : ('fa-calendar'); $color = $is_cancelled ? ('grey') : ('green'); - $status = $is_cancelled ? ('Cancelled') : ('Active'); + $status = $is_cancelled ? pht('Cancelled') : pht('Active'); $invite_status = $event->getUserInviteStatus($viewer->getPHID()); $status_invited = PhabricatorCalendarEventInvitee::STATUS_INVITED;