Page MenuHomePhabricator

D12736.diff
No OneTemporary

D12736.diff

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 @@
+<?php
+
+echo "Retro-naming unnamed events.\n";
+
+$table = new PhabricatorCalendarEvent();
+$conn_w = $table->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;

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 6, 12:23 AM (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717216
Default Alt Text
D12736.diff (1 KB)

Event Timeline