@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 PhabricatorProjectLockTransaction
4 extends PhabricatorProjectTransactionType {
5
6 const TRANSACTIONTYPE = 'project:locked';
7
8 public function generateOldValue($object) {
9 return (int)$object->getIsMembershipLocked();
10 }
11
12 public function applyInternalEffects($object, $value) {
13 $object->setIsMembershipLocked($value);
14 }
15
16 public function getTitle() {
17 $new = $this->getNewValue();
18
19 if ($new) {
20 return pht(
21 "%s locked this project's membership.",
22 $this->renderAuthor());
23 } else {
24 return pht(
25 "%s unlocked this project's membership.",
26 $this->renderAuthor());
27 }
28 }
29
30 public function getTitleForFeed() {
31 $new = $this->getNewValue();
32
33 if ($new) {
34 return pht(
35 '%s locked %s membership.',
36 $this->renderAuthor(),
37 $this->renderObject());
38 } else {
39 return pht(
40 '%s unlocked %s membership.',
41 $this->renderAuthor(),
42 $this->renderObject());
43 }
44 }
45
46 public function getIcon() {
47 $new = $this->getNewValue();
48
49 if ($new) {
50 return 'fa-lock';
51 } else {
52 return 'fa-unlock';
53 }
54 }
55
56 public function validateTransactions($object, array $xactions) {
57 if ($xactions) {
58 $this->requireApplicationCapability(
59 ProjectCanLockProjectsCapability::CAPABILITY);
60 }
61 return array();
62 }
63
64}