Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / calendar / xaction / PhabricatorCalendarEventHostTransaction.php
blobfebdbbd1a1990e4717c21f08240ff2e9fe5f2a47
1 <?php
3 final class PhabricatorCalendarEventHostTransaction
4 extends PhabricatorCalendarEventTransactionType {
6 const TRANSACTIONTYPE = 'calendar.host';
8 public function generateOldValue($object) {
9 return $object->getHostPHID();
12 public function applyInternalEffects($object, $value) {
13 $object->setHostPHID($value);
16 public function getTitle() {
17 return pht(
18 '%s changed the host of this event from %s to %s.',
19 $this->renderAuthor(),
20 $this->renderOldHandle(),
21 $this->renderNewHandle());
24 public function getTitleForFeed() {
25 return pht(
26 '%s changed the host of %s from %s to %s.',
27 $this->renderAuthor(),
28 $this->renderObject(),
29 $this->renderOldHandle(),
30 $this->renderNewHandle());
33 public function validateTransactions($object, array $xactions) {
34 $errors = array();
36 foreach ($xactions as $xaction) {
37 $host_phid = $xaction->getNewValue();
38 if (!$host_phid) {
39 $errors[] = $this->newRequiredError(
40 pht('Event host is required.'));
41 continue;
44 $user = id(new PhabricatorPeopleQuery())
45 ->setViewer($this->getActor())
46 ->withPHIDs(array($host_phid))
47 ->executeOne();
48 if (!$user) {
49 $errors[] = $this->newInvalidError(
50 pht(
51 'Host PHID "%s" is not a valid user PHID.',
52 $host_phid));
56 return $errors;