Merge changes Ie367ee54,Iee35af9c
* changes:
Remove overriding notify input to OWNER for wip reverts
Hide wip changes from the CC section in dashboard
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index 0c5ea40..517e4a8 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -7722,8 +7722,8 @@
RevertSubmission endpoint is `revert-{submission_id}-{timestamp.now}`.
Topic can't contain quotation marks.
|`work_in_progress` |optional|
-When present, change is marked as Work In Progress. This will also override
-the notify value to `OWNER`. +
+When present, change is marked as Work In Progress. The `notify` input is
+used if it's present, otherwise it will be overridden to `OWNER`. +
If not set, the default is false.
|=============================
diff --git a/java/com/google/gerrit/httpd/raw/IndexPreloadingUtil.java b/java/com/google/gerrit/httpd/raw/IndexPreloadingUtil.java
index 98e660c..3bdcb1a 100644
--- a/java/com/google/gerrit/httpd/raw/IndexPreloadingUtil.java
+++ b/java/com/google/gerrit/httpd/raw/IndexPreloadingUtil.java
@@ -66,7 +66,7 @@
"is:open owner:${user} -is:wip -is:ignored limit:25";
public static final String DASHBOARD_INCOMING_QUERY =
"is:open -owner:${user} -is:wip -is:ignored (reviewer:${user} OR assignee:${user}) limit:25";
- public static final String CC_QUERY = "is:open -is:ignored cc:${user} limit:10";
+ public static final String CC_QUERY = "is:open -is:ignored -is:wip cc:${user} limit:10";
public static final String DASHBOARD_RECENTLY_CLOSED_QUERY =
"is:closed -is:ignored (-is:wip OR owner:self) "
+ "(owner:${user} OR reviewer:${user} OR assignee:${user} "
diff --git a/java/com/google/gerrit/server/git/CommitUtil.java b/java/com/google/gerrit/server/git/CommitUtil.java
index 0e0185a..2259741 100644
--- a/java/com/google/gerrit/server/git/CommitUtil.java
+++ b/java/com/google/gerrit/server/git/CommitUtil.java
@@ -265,7 +265,7 @@
Change changeToRevert = notes.getChange();
Change.Id changeId = Change.id(seq.nextChangeId());
if (input.workInProgress) {
- input.notify = NotifyHandling.OWNER;
+ input.notify = firstNonNull(input.notify, NotifyHandling.OWNER);
}
NotifyResolver.Result notify =
notifyResolver.resolve(firstNonNull(input.notify, NotifyHandling.ALL), input.notifyDetails);
diff --git a/java/com/google/gerrit/server/restapi/change/RevertSubmission.java b/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
index 20249df..8bde6e7 100644
--- a/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
+++ b/java/com/google/gerrit/server/restapi/change/RevertSubmission.java
@@ -258,7 +258,7 @@
Project.NameKey project = projectAndBranch.project();
cherryPickInput.destination = projectAndBranch.branch();
if (revertInput.workInProgress) {
- cherryPickInput.notify = NotifyHandling.OWNER;
+ cherryPickInput.notify = firstNonNull(cherryPickInput.notify, NotifyHandling.OWNER);
}
Collection<ChangeData> changesInProjectAndBranch =
changesPerProjectAndBranch.get(projectAndBranch);
diff --git a/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java b/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
index 6cf3f3e..ff88f31 100644
--- a/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
+++ b/javatests/com/google/gerrit/acceptance/api/change/RevertIT.java
@@ -359,7 +359,10 @@
gApi.changes().id(r.getChangeId()).revision(r.getCommit().name()).submit();
sender.clear();
- gApi.changes().id(r.getChangeId()).revert(createWipRevertInput()).get();
+ // If notify input not specified, the endpoint overrides it to OWNER
+ RevertInput revertInput = createWipRevertInput();
+ revertInput.notify = null;
+ gApi.changes().id(r.getChangeId()).revert(revertInput).get();
assertThat(sender.getMessages()).isEmpty();
}
@@ -702,7 +705,7 @@
}
@Test
- public void revertSubmissionWipNotificationsAreSupressed() throws Exception {
+ public void revertSubmissionWipNotificationsWithNotifyHandlingAll() throws Exception {
String changeId1 = createChange("first change", "a.txt", "message").getChangeId();
approve(changeId1);
gApi.changes().id(changeId1).addReviewer(user.email());
@@ -714,13 +717,12 @@
sender.clear();
+ // If notify handling is specified, it will be used by the API
RevertInput revertInput = createWipRevertInput();
- // Setting the Notifications to ALL will be overridden because the WIP flag overrides the
- // notifications to OWNER
revertInput.notify = NotifyHandling.ALL;
gApi.changes().id(changeId2).revertSubmission(revertInput);
- assertThat(sender.getMessages()).isEmpty();
+ assertThat(sender.getMessages()).hasSize(4);
}
@Test
diff --git a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
index 6eaca5e..f27e0f1 100644
--- a/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
+++ b/polygerrit-ui/app/elements/core/gr-navigation/gr-navigation.ts
@@ -206,7 +206,7 @@
// Open changes the viewed user is CCed on. Changes ignored by the viewing
// user are filtered out.
name: 'CCed on',
- query: 'is:open -is:ignored cc:${user}',
+ query: 'is:open -is:ignored -is:wip cc:${user}',
suffixForDashboard: 'limit:10',
};
export const CLOSED: DashboardSection = {