1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 01:08:50 +02:00
phorge-phorge/resources/sql/autopatches/20180403.draft.01.broadcast.php
epriestley 615d27c8e9 Show an additional "Draft" tag on non-broadcasting revisions in a non-draft state
Summary:
Depends on D19284. Ref T13110. It's now possible to get a revision into a "Abandoned + But, Never Promoted From Draft" state. Show this in the header and provide the draft hint above the comment area.

Also, remove `shouldBroadcast()`. The method `getShouldBroadcast()` now has the same meaning.

Finally, migrate existing drafts to `shouldBroadcast = false` and default `shouldBroadcast` to `true`. If we don't do this, every older revision becomes a non-broadcasting revision because this flag was not explicitly set on revision creation before, only on promotion out of draft.

Test Plan: Ran migration; abandoned draft revisions and ended up in a draft + abandoned state.

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13110

Differential Revision: https://secure.phabricator.com/D19285
2018-04-03 11:09:49 -07:00

20 lines
505 B
PHP

<?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());
}