@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 PhabricatorRepositoryIdentityEditEngine
4 extends PhabricatorEditEngine {
5
6 const ENGINECONST = 'repository.identity';
7
8 public function isEngineConfigurable() {
9 return false;
10 }
11
12 public function getEngineName() {
13 return pht('Repository Identities');
14 }
15
16 public function getSummaryHeader() {
17 return pht('Edit Repository Identity Configurations');
18 }
19
20 public function getSummaryText() {
21 return pht('This engine is used to edit Repository identities.');
22 }
23
24 public function getEngineApplicationClass() {
25 return PhabricatorDiffusionApplication::class;
26 }
27
28 protected function newEditableObject() {
29 return new PhabricatorRepositoryIdentity();
30 }
31
32 protected function newObjectQuery() {
33 return new PhabricatorRepositoryIdentityQuery();
34 }
35
36 protected function getObjectCreateTitleText($object) {
37 return pht('Create Identity');
38 }
39
40 protected function getObjectCreateButtonText($object) {
41 return pht('Create Identity');
42 }
43
44 protected function getObjectEditTitleText($object) {
45 return pht('Edit Identity: %s', $object->getIdentityShortName());
46 }
47
48 protected function getObjectEditShortText($object) {
49 return pht('Edit Identity');
50 }
51
52 protected function getObjectCreateShortText() {
53 return pht('Create Identity');
54 }
55
56 protected function getObjectName() {
57 return pht('Identity');
58 }
59
60 protected function getEditorURI() {
61 return '/diffusion/identity/edit/';
62 }
63
64 protected function getObjectCreateCancelURI($object) {
65 return '/diffusion/identity/';
66 }
67
68 protected function getObjectViewURI($object) {
69 return $object->getURI();
70 }
71
72 protected function getCreateNewObjectPolicy() {
73 return $this->getApplication()->getPolicy(
74 PhabricatorRepositoryIdentityEditViewCapability::CAPABILITY);
75 }
76
77 protected function buildCustomEditFields($object) {
78 return array(
79 id(new DiffusionIdentityAssigneeEditField())
80 ->setKey('manuallySetUserPHID')
81 ->setLabel(pht('Assigned To'))
82 ->setDescription(pht('Override this identity\'s assignment.'))
83 ->setTransactionType(
84 PhabricatorRepositoryIdentityAssignTransaction::TRANSACTIONTYPE)
85 ->setIsCopyable(true)
86 ->setIsNullable(true)
87 ->setSingleValue($object->getManuallySetUserPHID()),
88
89 );
90 }
91
92}