Remove DraftHandling.DELETE
Using this as the default is more dangerous than useful: if a caller forgets to populate the `drafts` field in ReviewInput, then drafts are unceremoniously deleted. A much safer default is KEEP; this also comes closest to preserving the old behavior, which also does not publish any drafts. We don't know of anybody relying on DELETE as the default, but just in case, this is probably the safest new default. An alternative proposal[1] would phase out the old default more slowly. However, given that the community couldn't come up with any use cases for the old default[2], that much caution is unnecessary, especially when compared with the real risk of data loss in the current state. [1] https://gerrit-review.googlesource.com/c/gerrit/+/140055 [2] https://groups.google.com/d/topic/repo-discuss/caWj8VqUVDY/discussion Change-Id: Idd8cdd6e93c17f296dc62c400980323f0167ae9f
This commit is contained in:
@@ -48,8 +48,8 @@ public class ReviewInput {
|
||||
* How to process draft comments already in the database that were not also described in this
|
||||
* input request.
|
||||
*
|
||||
* <p>Defaults to DELETE, unless {@link #onBehalfOf} is set, in which case it defaults to KEEP and
|
||||
* any other value is disallowed.
|
||||
* <p>If not set, the default is {@link DraftHandling#KEEP}. If {@link #onBehalfOf} is set, then
|
||||
* no other value besides {@code KEEP} is allowed.
|
||||
*/
|
||||
public DraftHandling drafts;
|
||||
|
||||
@@ -87,15 +87,12 @@ public class ReviewInput {
|
||||
public boolean ready;
|
||||
|
||||
public enum DraftHandling {
|
||||
/** Delete pending drafts on this revision only. */
|
||||
DELETE,
|
||||
/** Leave pending drafts alone. */
|
||||
KEEP,
|
||||
|
||||
/** Publish pending drafts on this revision only. */
|
||||
PUBLISH,
|
||||
|
||||
/** Leave pending drafts alone. */
|
||||
KEEP,
|
||||
|
||||
/** Publish pending drafts on all revisions. */
|
||||
PUBLISH_ALL_REVISIONS
|
||||
}
|
||||
|
Reference in New Issue
Block a user