@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 PhabricatorSlowvoteResponsesTransaction
4 extends PhabricatorSlowvoteTransactionType {
5
6 const TRANSACTIONTYPE = 'vote:responses';
7
8 public function generateOldValue($object) {
9 return (string)$object->getResponseVisibility();
10 }
11
12 public function generateNewValue($object, $value) {
13 return (string)$value;
14 }
15
16 public function applyInternalEffects($object, $value) {
17 $object->setResponseVisibility($value);
18 }
19
20 public function getTitle() {
21 $old_name = $this->getOldResponseVisibilityObject()->getName();
22 $new_name = $this->getNewResponseVisibilityObject()->getName();
23
24 return pht(
25 '%s changed who can see the responses from %s to %s.',
26 $this->renderAuthor(),
27 $this->renderValue($old_name),
28 $this->renderValue($new_name));
29 }
30
31 public function getTitleForFeed() {
32 $old_name = $this->getOldResponseVisibilityObject()->getName();
33 $new_name = $this->getNewResponseVisibilityObject()->getName();
34
35 return pht(
36 '%s changed who can see the responses of %s from %s to %s.',
37 $this->renderAuthor(),
38 $this->renderObject(),
39 $this->renderValue($old_name),
40 $this->renderValue($new_name));
41 }
42
43 private function getOldResponseVisibilityObject() {
44 return $this->newResponseVisibilityObject($this->getOldValue());
45 }
46
47 private function getNewResponseVisibilityObject() {
48 return $this->newResponseVisibilityObject($this->getNewValue());
49 }
50
51 private function newResponseVisibilityObject($value) {
52 return SlowvotePollResponseVisibility::newResponseVisibilityObject($value);
53 }
54
55}