Make some Differential comment actions (like "Accept" and "Reject") conflict with one another
Summary: Ref T11114. When a user selects "Accept", and then selects "Reject", remove the "Accept". It does not make sense to both accept and reject a revision. For now, every one of the "actions" conflicts: accept, reject, resign, claim, close, commandeer, etc, etc. I couldn't come up with any combinations that it seems like users are reasonably likely to want to try, and we haven't received combo-action requests in the past that I can recall. Test Plan: - Selected "Accept", then selected "Reject". One replaced the other. - Selected "Accept", then selected "Change Subscribers". Both co-existed happily. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11114 Differential Revision: https://secure.phabricator.com/D17132
This commit is contained in:
@@ -73,6 +73,18 @@ abstract class DifferentialRevisionActionTransaction
|
||||
|
||||
$group_key = $this->getRevisionActionGroupKey();
|
||||
$field->setCommentActionGroupKey($group_key);
|
||||
|
||||
// Currently, every revision action conflicts with every other
|
||||
// revision action: for example, you can not simultaneously Accept and
|
||||
// Reject a revision.
|
||||
|
||||
// Under some configurations, some combinations of actions are sort of
|
||||
// technically permissible. For example, you could reasonably Reject
|
||||
// and Abandon a revision if "anyone can abandon anything" is enabled.
|
||||
|
||||
// It's not clear that these combinations are actually useful, so just
|
||||
// keep things simple for now.
|
||||
$field->setActionConflictKey('revision.action');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ abstract class PhabricatorEditEngineCommentAction extends Phobject {
|
||||
private $initialValue;
|
||||
private $order;
|
||||
private $groupKey;
|
||||
private $conflictKey;
|
||||
|
||||
abstract public function getPHUIXControlType();
|
||||
abstract public function getPHUIXControlSpecification();
|
||||
@@ -30,6 +31,15 @@ abstract class PhabricatorEditEngineCommentAction extends Phobject {
|
||||
return $this->groupKey;
|
||||
}
|
||||
|
||||
public function setConflictKey($conflict_key) {
|
||||
$this->conflictKey = $conflict_key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getConflictKey() {
|
||||
return $this->conflictKey;
|
||||
}
|
||||
|
||||
public function setLabel($label) {
|
||||
$this->label = $label;
|
||||
return $this;
|
||||
|
||||
@@ -4,6 +4,7 @@ final class PhabricatorApplyEditField
|
||||
extends PhabricatorEditField {
|
||||
|
||||
private $actionDescription;
|
||||
private $actionConflictKey;
|
||||
|
||||
protected function newControl() {
|
||||
return null;
|
||||
@@ -18,6 +19,15 @@ final class PhabricatorApplyEditField
|
||||
return $this->actionDescription;
|
||||
}
|
||||
|
||||
public function setActionConflictKey($action_conflict_key) {
|
||||
$this->actionConflictKey = $action_conflict_key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getActionConflictKey() {
|
||||
return $this->actionConflictKey;
|
||||
}
|
||||
|
||||
protected function newHTTPParameterType() {
|
||||
return new AphrontBoolHTTPParameterType();
|
||||
}
|
||||
@@ -34,7 +44,8 @@ final class PhabricatorApplyEditField
|
||||
|
||||
protected function newCommentAction() {
|
||||
return id(new PhabricatorEditEngineStaticCommentAction())
|
||||
->setDescription($this->getActionDescription());
|
||||
->setDescription($this->getActionDescription())
|
||||
->setConflictKey($this->getActionConflictKey());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -301,6 +301,7 @@ class PhabricatorApplicationTransactionCommentView extends AphrontView {
|
||||
'spec' => $comment_action->getPHUIXControlSpecification(),
|
||||
'initialValue' => $comment_action->getInitialValue(),
|
||||
'groupKey' => $comment_action->getGroupKey(),
|
||||
'conflictKey' => $comment_action->getConflictKey(),
|
||||
);
|
||||
|
||||
$type_map[$key] = $comment_action;
|
||||
|
||||
Reference in New Issue
Block a user