Differential D12934 Diff 31137 src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/storage/PhabricatorCalendarEventTransaction.php
<?php | <?php | ||||
final class PhabricatorCalendarEventTransaction | final class PhabricatorCalendarEventTransaction | ||||
extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
const TYPE_NAME = 'calendar.name'; | const TYPE_NAME = 'calendar.name'; | ||||
const TYPE_START_DATE = 'calendar.startdate'; | const TYPE_START_DATE = 'calendar.startdate'; | ||||
const TYPE_END_DATE = 'calendar.enddate'; | const TYPE_END_DATE = 'calendar.enddate'; | ||||
const TYPE_DESCRIPTION = 'calendar.description'; | const TYPE_DESCRIPTION = 'calendar.description'; | ||||
const TYPE_CANCEL = 'calendar.cancel'; | const TYPE_CANCEL = 'calendar.cancel'; | ||||
const TYPE_ALL_DAY = 'calendar.allday'; | const TYPE_ALL_DAY = 'calendar.allday'; | ||||
const TYPE_ICON = 'calendar.icon'; | |||||
const TYPE_INVITE = 'calendar.invite'; | const TYPE_INVITE = 'calendar.invite'; | ||||
const MAILTAG_RESCHEDULE = 'calendar-reschedule'; | const MAILTAG_RESCHEDULE = 'calendar-reschedule'; | ||||
const MAILTAG_CONTENT = 'calendar-content'; | const MAILTAG_CONTENT = 'calendar-content'; | ||||
const MAILTAG_OTHER = 'calendar-other'; | const MAILTAG_OTHER = 'calendar-other'; | ||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'calendar'; | return 'calendar'; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | switch ($this->getTransactionType()) { | ||||
case self::TYPE_INVITE: | case self::TYPE_INVITE: | ||||
return ($old === null); | return ($old === null); | ||||
} | } | ||||
return parent::shouldHide(); | return parent::shouldHide(); | ||||
} | } | ||||
public function getIcon() { | public function getIcon() { | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_ICON: | |||||
return $this->getNewValue(); | |||||
case self::TYPE_NAME: | case self::TYPE_NAME: | ||||
case self::TYPE_START_DATE: | case self::TYPE_START_DATE: | ||||
case self::TYPE_END_DATE: | case self::TYPE_END_DATE: | ||||
case self::TYPE_DESCRIPTION: | case self::TYPE_DESCRIPTION: | ||||
case self::TYPE_ALL_DAY: | case self::TYPE_ALL_DAY: | ||||
case self::TYPE_CANCEL: | case self::TYPE_CANCEL: | ||||
return 'fa-pencil'; | return 'fa-pencil'; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | switch ($type) { | ||||
return pht( | return pht( | ||||
'%s made this an all day event.', | '%s made this an all day event.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s converted this from an all day event.', | '%s converted this from an all day event.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} | } | ||||
case self::TYPE_ICON: | |||||
return pht( | |||||
'%s set this event\'s icon to %s.', | |||||
$this->renderHandleLink($author_phid), | |||||
PhabricatorCalendarIcon::getLabel($new)); | |||||
break; | |||||
case self::TYPE_CANCEL: | case self::TYPE_CANCEL: | ||||
if ($new) { | if ($new) { | ||||
return pht( | return pht( | ||||
'%s cancelled this event.', | '%s cancelled this event.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s reinstated this event.', | '%s reinstated this event.', | ||||
▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | switch ($type) { | ||||
$this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
$this->renderHandleLink($object_phid)); | $this->renderHandleLink($object_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
'%s converted %s from an all day event.', | '%s converted %s from an all day event.', | ||||
$this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
$this->renderHandleLink($object_phid)); | $this->renderHandleLink($object_phid)); | ||||
} | } | ||||
case self::TYPE_ICON: | |||||
return pht( | |||||
'%s set the icon for %s to %s.', | |||||
$this->renderHandleLink($author_phid), | |||||
$this->renderHandleLink($object_phid), | |||||
PhabricatorCalendarIcon::getLabel($new)); | |||||
case self::TYPE_CANCEL: | case self::TYPE_CANCEL: | ||||
if ($new) { | if ($new) { | ||||
return pht( | return pht( | ||||
'%s cancelled %s.', | '%s cancelled %s.', | ||||
$this->renderHandleLink($author_phid), | $this->renderHandleLink($author_phid), | ||||
$this->renderHandleLink($object_phid)); | $this->renderHandleLink($object_phid)); | ||||
} else { | } else { | ||||
return pht( | return pht( | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | final class PhabricatorCalendarEventTransaction | ||||
} | } | ||||
public function getMailTags() { | public function getMailTags() { | ||||
$tags = array(); | $tags = array(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_NAME: | case self::TYPE_NAME: | ||||
case self::TYPE_DESCRIPTION: | case self::TYPE_DESCRIPTION: | ||||
case self::TYPE_INVITE: | case self::TYPE_INVITE: | ||||
case self::TYPE_ICON: | |||||
$tags[] = self::MAILTAG_CONTENT; | $tags[] = self::MAILTAG_CONTENT; | ||||
break; | break; | ||||
case self::TYPE_START_DATE: | case self::TYPE_START_DATE: | ||||
case self::TYPE_END_DATE: | case self::TYPE_END_DATE: | ||||
case self::TYPE_CANCEL: | case self::TYPE_CANCEL: | ||||
$tags[] = self::MAILTAG_RESCHEDULE; | $tags[] = self::MAILTAG_RESCHEDULE; | ||||
break; | break; | ||||
} | } | ||||
return $tags; | return $tags; | ||||
} | } | ||||
} | } |