@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3final class PhabricatorSpacesNamespaceDefaultTransaction
4 extends PhabricatorSpacesNamespaceTransactionType {
5
6 const TRANSACTIONTYPE = 'spaces:default';
7
8 public function generateOldValue($object) {
9 return $object->getIsDefaultNamespace();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setIsDefaultNamespace($value);
14 }
15
16 public function getTitle() {
17 return pht(
18 '%s made this the default space.',
19 $this->renderAuthor());
20 }
21
22 public function getTitleForFeed() {
23 return pht(
24 '%s made space %s the default space.',
25 $this->renderAuthor(),
26 $this->renderObject());
27
28 }
29
30 public function validateTransactions($object, array $xactions) {
31 $errors = array();
32
33 if (!$this->isNewObject()) {
34 foreach ($xactions as $xaction) {
35 $errors[] = $this->newInvalidError(
36 pht('Only the first space created can be the default space, and '.
37 'it must remain the default space evermore.'));
38 }
39 }
40
41 return $errors;
42 }
43
44}