Remove Revert Submission button
Since the frontend change I5b7d6b6b5 the button for "Revert" now does "Revert Submission", so the button for "Revert Submission" is redundant. The button should be removed after confirming that the frontend change works as expected. Change-Id: I9b646ad45d40772eedfab1128480872e4fdfc47a
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
package com.google.gerrit.server.restapi.change;
|
||||
|
||||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.gerrit.extensions.conditions.BooleanCondition.and;
|
||||
import static com.google.gerrit.server.permissions.RefPermission.CREATE_CHANGE;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
@@ -39,7 +38,6 @@ import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.extensions.restapi.Response;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.extensions.restapi.RestModifyView;
|
||||
import com.google.gerrit.extensions.webui.UiAction;
|
||||
import com.google.gerrit.server.ChangeMessagesUtil;
|
||||
import com.google.gerrit.server.ChangeUtil;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
@@ -97,8 +95,7 @@ import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
|
||||
public class RevertSubmission
|
||||
implements RestModifyView<ChangeResource, RevertInput>, UiAction<ChangeResource> {
|
||||
public class RevertSubmission implements RestModifyView<ChangeResource, RevertInput> {
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Provider<InternalChangeQuery> queryProvider;
|
||||
@@ -529,32 +526,6 @@ public class RevertSubmission
|
||||
potentialCommitToReturn.getName(), changeNotes.getChange().getChangeId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Description getDescription(ChangeResource rsrc) {
|
||||
Change change = rsrc.getChange();
|
||||
boolean projectStatePermitsWrite = false;
|
||||
try {
|
||||
projectStatePermitsWrite = projectCache.checkedGet(rsrc.getProject()).statePermitsWrite();
|
||||
} catch (IOException e) {
|
||||
logger.atSevere().withCause(e).log(
|
||||
"Failed to check if project state permits write: %s", rsrc.getProject());
|
||||
}
|
||||
return new UiAction.Description()
|
||||
.setLabel("Revert submission")
|
||||
.setTitle(
|
||||
"Revert this change and all changes that have been submitted together with this change")
|
||||
.setVisible(
|
||||
and(
|
||||
change.isMerged()
|
||||
&& change.getSubmissionId() != null
|
||||
&& isChangePartOfSubmission(change.getSubmissionId())
|
||||
&& projectStatePermitsWrite,
|
||||
permissionBackend
|
||||
.user(rsrc.getUser())
|
||||
.ref(change.getDest())
|
||||
.testCond(CREATE_CHANGE)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param submissionId the submission id of the change.
|
||||
* @return True if the submission has more than one change, false otherwise.
|
||||
|
||||
@@ -78,22 +78,6 @@ public class ActionsIT extends AbstractDaemonTest {
|
||||
gApi.changes().id(changeId).current().submit();
|
||||
Map<String, ActionInfo> actions = getChangeActions(changeId);
|
||||
assertThat(actions).containsKey("revert");
|
||||
assertThat(actions).doesNotContainKey("revert_submission");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changeActionTwoMergedChangesHaveReverts() throws Exception {
|
||||
String changeId1 = createChangeWithTopic().getChangeId();
|
||||
String changeId2 = createChangeWithTopic().getChangeId();
|
||||
gApi.changes().id(changeId1).current().review(ReviewInput.approve());
|
||||
gApi.changes().id(changeId2).current().review(ReviewInput.approve());
|
||||
gApi.changes().id(changeId2).current().submit();
|
||||
Map<String, ActionInfo> actions1 = getChangeActions(changeId1);
|
||||
assertThat(actions1).containsKey("revert");
|
||||
assertThat(actions1).containsKey("revert_submission");
|
||||
Map<String, ActionInfo> actions2 = getChangeActions(changeId2);
|
||||
assertThat(actions2).containsKey("revert");
|
||||
assertThat(actions2).containsKey("revert_submission");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user