@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
3abstract class PhabricatorEditEngineLock
4 extends Phobject {
5
6 private $viewer;
7 private $object;
8
9 final public function setViewer(PhabricatorUser $viewer) {
10 $this->viewer = $viewer;
11 return $this;
12 }
13
14 final public function getViewer() {
15 return $this->viewer;
16 }
17
18 final public function setObject($object) {
19 $this->object = $object;
20 return $this;
21 }
22
23 final public function getObject() {
24 return $this->object;
25 }
26
27 public function willPromptUserForLockOverrideWithDialog(
28 AphrontDialogView $dialog) {
29
30 return $dialog
31 ->setTitle(pht('Edit Locked Object'))
32 ->appendParagraph(pht('This object is locked. Edit it anyway?'))
33 ->addSubmitButton(pht('Override Lock'));
34 }
35
36 public function willBlockUserInteractionWithDialog(
37 AphrontDialogView $dialog) {
38
39 return $dialog
40 ->setTitle(pht('Object Locked'))
41 ->appendParagraph(
42 pht('You can not interact with this object because it is locked.'));
43 }
44
45 public function getLockedObjectDisplayText() {
46 return pht('This object has been locked.');
47 }
48
49 public static function newForObject(
50 PhabricatorUser $viewer,
51 $object) {
52
53 if ($object instanceof PhabricatorEditEngineLockableInterface) {
54 $lock = $object->newEditEngineLock();
55 } else {
56 $lock = new PhabricatorEditEngineDefaultLock();
57 }
58
59 return $lock
60 ->setViewer($viewer)
61 ->setObject($object);
62 }
63
64
65
66}