3 final class PhabricatorCalendarImportICSURITransaction
4 extends PhabricatorCalendarImportTransactionType
{
6 const TRANSACTIONTYPE
= 'calendar.import.ics.uri';
7 const PARAMKEY_URI
= 'ics.uri';
9 public function generateOldValue($object) {
10 return $object->getParameter(self
::PARAMKEY_URI
);
13 public function applyInternalEffects($object, $value) {
14 $object->setParameter(self
::PARAMKEY_URI
, $value);
17 public function getTitle() {
18 // NOTE: This transaction intentionally does not disclose the actual
21 '%s updated the import URI.',
22 $this->renderAuthor());
25 public function validateTransactions($object, array $xactions) {
26 $viewer = $this->getActor();
29 $ics_type = PhabricatorCalendarICSURIImportEngine
::ENGINETYPE
;
30 $import_type = $object->getEngine()->getImportEngineType();
31 if ($import_type != $ics_type) {
36 $errors[] = $this->newInvalidError(
38 'You can not attach an ICS URI to an import type other than '.
39 'an ICS URI import (type is "%s").',
45 $new_value = $object->getParameter(self
::PARAMKEY_URI
);
46 foreach ($xactions as $xaction) {
47 $new_value = $xaction->getNewValue();
48 if (!strlen($new_value)) {
53 PhabricatorEnv
::requireValidRemoteURIForFetch(
59 } catch (Exception
$ex) {
60 $errors[] = $this->newInvalidError(
66 if (!strlen($new_value)) {
67 $errors[] = $this->newRequiredError(
68 pht('You must select an ".ics" URI to import.'));