Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13965128
D14811.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D14811.id.diff
View Options
diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
--- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
+++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
@@ -306,20 +306,27 @@
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
return array_values($this->subscribers);
case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ if ($this->getIsNewObject()) {
+ return null;
+ }
return $object->getViewPolicy();
case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ if ($this->getIsNewObject()) {
+ return null;
+ }
return $object->getEditPolicy();
case PhabricatorTransactions::TYPE_JOIN_POLICY:
+ if ($this->getIsNewObject()) {
+ return null;
+ }
return $object->getJoinPolicy();
case PhabricatorTransactions::TYPE_SPACE:
+ if ($this->getIsNewObject()) {
+ return null;
+ }
+
$space_phid = $object->getSpacePHID();
if ($space_phid === null) {
- if ($this->getIsNewObject()) {
- // In this case, just return `null` so we know this is the initial
- // transaction and it should be hidden.
- return null;
- }
-
$default_space = PhabricatorSpacesNamespaceQuery::getDefaultSpace();
if ($default_space) {
$space_phid = $default_space->getPHID();
diff --git a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
--- a/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
+++ b/src/applications/transactions/storage/PhabricatorApplicationTransaction.php
@@ -481,14 +481,22 @@
// transactions like "alice set the task tile to: ...", which are
// essentially never interesting.
if ($this->getIsCreateTransaction()) {
- $old = $this->getOldValue();
+ switch ($this->getTransactionType()) {
+ case PhabricatorTransactions::TYPE_VIEW_POLICY:
+ case PhabricatorTransactions::TYPE_EDIT_POLICY:
+ case PhabricatorTransactions::TYPE_JOIN_POLICY:
+ case PhabricatorTransactions::TYPE_SPACE:
+ break;
+ default:
+ $old = $this->getOldValue();
- if (is_array($old) && !$old) {
- return true;
- }
+ if (is_array($old) && !$old) {
+ return true;
+ }
- if (!strlen($old)) {
- return true;
+ if (!strlen($old)) {
+ return true;
+ }
}
}
@@ -510,6 +518,13 @@
case PhabricatorTransactions::TYPE_EDIT_POLICY:
case PhabricatorTransactions::TYPE_JOIN_POLICY:
case PhabricatorTransactions::TYPE_SPACE:
+ if ($this->getIsCreateTransaction()) {
+ break;
+ }
+
+ // TODO: Remove this eventually, this is handling old changes during
+ // object creation prior to the introduction of "create" and "default"
+ // transaction display flags.
if ($this->getOldValue() === null) {
return true;
} else {
@@ -692,29 +707,57 @@
'%s added a comment.',
$this->renderHandleLink($author_phid));
case PhabricatorTransactions::TYPE_VIEW_POLICY:
- return pht(
- '%s changed the visibility from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
+ if ($this->getIsCreateTransaction()) {
+ return pht(
+ '%s created this object with visibility "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($new, 'new'));
+ } else {
+ return pht(
+ '%s changed the visibility from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ }
case PhabricatorTransactions::TYPE_EDIT_POLICY:
- return pht(
- '%s changed the edit policy from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
+ if ($this->getIsCreateTransaction()) {
+ return pht(
+ '%s created this object with edit policy "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($new, 'new'));
+ } else {
+ return pht(
+ '%s changed the edit policy from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ }
case PhabricatorTransactions::TYPE_JOIN_POLICY:
- return pht(
- '%s changed the join policy from "%s" to "%s".',
- $this->renderHandleLink($author_phid),
- $this->renderPolicyName($old, 'old'),
- $this->renderPolicyName($new, 'new'));
+ if ($this->getIsCreateTransaction()) {
+ return pht(
+ '%s created this object with join policy "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($new, 'new'));
+ } else {
+ return pht(
+ '%s changed the join policy from "%s" to "%s".',
+ $this->renderHandleLink($author_phid),
+ $this->renderPolicyName($old, 'old'),
+ $this->renderPolicyName($new, 'new'));
+ }
case PhabricatorTransactions::TYPE_SPACE:
- return pht(
- '%s shifted this object from the %s space to the %s space.',
- $this->renderHandleLink($author_phid),
- $this->renderHandleLink($old),
- $this->renderHandleLink($new));
+ if ($this->getIsCreateTransaction()) {
+ return pht(
+ '%s created this object in space %s.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($new));
+ } else {
+ return pht(
+ '%s shifted this object from the %s space to the %s space.',
+ $this->renderHandleLink($author_phid),
+ $this->renderHandleLink($old),
+ $this->renderHandleLink($new));
+ }
case PhabricatorTransactions::TYPE_SUBSCRIBERS:
$add = array_diff($new, $old);
$rem = array_diff($old, $new);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 17 2024, 12:05 AM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6719760
Default Alt Text
D14811.id.diff (6 KB)
Attached To
Mode
D14811: Improve the clarity of transactions that affect policies and spaces during object creation
Attached
Detach File
Event Timeline
Log In to Comment