Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15389816
D19285.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D19285.diff
View Options
diff --git a/resources/sql/autopatches/20180403.draft.01.broadcast.php b/resources/sql/autopatches/20180403.draft.01.broadcast.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20180403.draft.01.broadcast.php
@@ -0,0 +1,20 @@
+<?php
+
+$table = new DifferentialRevision();
+$conn = $table->establishConnection('w');
+
+$drafts = $table->loadAllWhere(
+ 'status = %s',
+ DifferentialRevisionStatus::DRAFT);
+foreach ($drafts as $draft) {
+ $properties = $draft->getProperties();
+
+ $properties[DifferentialRevision::PROPERTY_SHOULD_BROADCAST] = false;
+
+ queryfx(
+ $conn,
+ 'UPDATE %T SET properties = %s WHERE id = %d',
+ id(new DifferentialRevision())->getTableName(),
+ phutil_json_encode($properties),
+ $draft->getID());
+}
diff --git a/src/applications/differential/controller/DifferentialRevisionViewController.php b/src/applications/differential/controller/DifferentialRevisionViewController.php
--- a/src/applications/differential/controller/DifferentialRevisionViewController.php
+++ b/src/applications/differential/controller/DifferentialRevisionViewController.php
@@ -525,11 +525,27 @@
$status_tag = id(new PHUITagView())
->setName($revision->getStatusDisplayName())
->setIcon($revision->getStatusIcon())
- ->setColor($revision->getStatusIconColor())
+ ->setColor($revision->getStatusTagColor())
->setType(PHUITagView::TYPE_SHADE);
$view->addProperty(PHUIHeaderView::PROPERTY_STATUS, $status_tag);
+ // If the revision is in a status other than "Draft", but not broadcasting,
+ // add an additional "Draft" tag to the header to make it clear that this
+ // revision hasn't promoted yet.
+ if (!$revision->getShouldBroadcast() && !$revision->isDraft()) {
+ $draft_status = DifferentialRevisionStatus::newForStatus(
+ DifferentialRevisionStatus::DRAFT);
+
+ $draft_tag = id(new PHUITagView())
+ ->setName($draft_status->getDisplayName())
+ ->setIcon($draft_status->getIcon())
+ ->setColor($draft_status->getTagColor())
+ ->setType(PHUITagView::TYPE_SHADE);
+
+ $view->addTag($draft_tag);
+ }
+
return $view;
}
diff --git a/src/applications/differential/customfield/DifferentialDraftField.php b/src/applications/differential/customfield/DifferentialDraftField.php
--- a/src/applications/differential/customfield/DifferentialDraftField.php
+++ b/src/applications/differential/customfield/DifferentialDraftField.php
@@ -101,7 +101,7 @@
public function getWarningsForDetailView() {
$revision = $this->getObject();
- if (!$revision->isDraft()) {
+ if ($revision->getShouldBroadcast()) {
return array();
}
diff --git a/src/applications/differential/editor/DifferentialTransactionEditor.php b/src/applications/differential/editor/DifferentialTransactionEditor.php
--- a/src/applications/differential/editor/DifferentialTransactionEditor.php
+++ b/src/applications/differential/editor/DifferentialTransactionEditor.php
@@ -487,7 +487,7 @@
PhabricatorLiskDAO $object,
array $xactions) {
- if (!$object->shouldBroadcast()) {
+ if (!$object->getShouldBroadcast()) {
return false;
}
@@ -498,7 +498,7 @@
PhabricatorLiskDAO $object,
array $xactions) {
- if (!$object->shouldBroadcast()) {
+ if (!$object->getShouldBroadcast()) {
return false;
}
@@ -1152,7 +1152,7 @@
// If the object is still a draft, prevent "Send me an email" and other
// similar rules from acting yet.
- if (!$object->shouldBroadcast()) {
+ if (!$object->getShouldBroadcast()) {
$adapter->setForbiddenAction(
HeraldMailableState::STATECONST,
DifferentialHeraldStateReasons::REASON_DRAFT);
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -679,6 +679,10 @@
return $this->getStatusObject()->getIconColor();
}
+ public function getStatusTagColor() {
+ return $this->getStatusObject()->getTagColor();
+ }
+
public function getStatusObject() {
$status = $this->getStatus();
return DifferentialRevisionStatus::newForStatus($status);
@@ -704,14 +708,6 @@
return $this;
}
- public function shouldBroadcast() {
- if (!$this->isDraft()) {
- return true;
- }
-
- return false;
- }
-
public function getHoldAsDraft() {
return $this->getProperty(self::PROPERTY_DRAFT_HOLD, false);
}
@@ -721,7 +717,7 @@
}
public function getShouldBroadcast() {
- return $this->getProperty(self::PROPERTY_SHOULD_BROADCAST, false);
+ return $this->getProperty(self::PROPERTY_SHOULD_BROADCAST, true);
}
public function setShouldBroadcast($should_broadcast) {
@@ -746,7 +742,6 @@
return $this->getProperty(self::PROPERTY_LINES_REMOVED);
}
-
public function getBuildableStatus($phid) {
$buildables = $this->getProperty(self::PROPERTY_BUILDABLES);
if (!is_array($buildables)) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 5:40 AM (6 d, 14 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7383168
Default Alt Text
D19285.diff (5 KB)
Attached To
Mode
D19285: Show an additional "Draft" tag on non-broadcasting revisions in a non-draft state
Attached
Detach File
Event Timeline
Log In to Comment