@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 AlmanacNamespaceEditor
4 extends AlmanacEditor {
5
6 public function getEditorObjectsDescription() {
7 return pht('Almanac Namespace');
8 }
9
10 public function getCreateObjectTitle($author, $object) {
11 return pht('%s created this namespace.', $author);
12 }
13
14 public function getCreateObjectTitleForFeed($author, $object) {
15 return pht('%s created %s.', $author, $object);
16 }
17
18 protected function supportsSearch() {
19 return true;
20 }
21
22 public function getTransactionTypes() {
23 $types = parent::getTransactionTypes();
24
25 $types[] = PhabricatorTransactions::TYPE_VIEW_POLICY;
26 $types[] = PhabricatorTransactions::TYPE_EDIT_POLICY;
27
28 return $types;
29 }
30
31 protected function didCatchDuplicateKeyException(
32 PhabricatorLiskDAO $object,
33 array $xactions,
34 Exception $ex) {
35
36 $errors = array();
37
38 $errors[] = new PhabricatorApplicationTransactionValidationError(
39 null,
40 pht('Invalid'),
41 pht(
42 'Another namespace with this name already exists. Each namespace '.
43 'must have a unique name.'),
44 null);
45
46 throw new PhabricatorApplicationTransactionValidationException($errors);
47 }
48
49}