diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt index 11e0666e33..799c13c663 100644 --- a/Documentation/dev-plugins.txt +++ b/Documentation/dev-plugins.txt @@ -475,9 +475,9 @@ class MyPlugin { ---- Plugins which define new Events should register them via the -`com.google.gerrit.server.events.EventTypes.registerClass()` -method. This will make the EventType known to the system. -Deserializing events with the +`com.google.gerrit.server.events.EventTypes.register()` method. +This will make the EventType known to the system. Deserializing +events with the `com.google.gerrit.server.events.EventDeserializer` class requires that the event be registered in EventTypes. diff --git a/java/com/google/gerrit/extensions/systemstatus/MessageOfTheDay.java b/java/com/google/gerrit/extensions/systemstatus/MessageOfTheDay.java deleted file mode 100644 index 180a0e6635..0000000000 --- a/java/com/google/gerrit/extensions/systemstatus/MessageOfTheDay.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (C) 2014 The Android Open Source Project -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package com.google.gerrit.extensions.systemstatus; - -import com.google.gerrit.extensions.annotations.ExtensionPoint; -import java.util.Calendar; -import java.util.Date; -import java.util.TimeZone; - -/** - * Supplies a message of the day when the page is first loaded. - * - *
- * DynamicSet.bind(binder(), MessageOfTheDay.class).to(MyMessage.class); - *- */ -@ExtensionPoint -public abstract class MessageOfTheDay { - /** - * Retrieve the message of the day as an HTML fragment. - * - * @return message as an HTML fragment; null if no message is available. - */ - public abstract String getHtmlMessage(); - - /** - * Unique identifier for this message. - * - *
Messages with the same identifier will be hidden from the user until redisplay has occurred. - * - * @return unique message identifier. This identifier should be unique within the server. - */ - public abstract String getMessageId(); - - /** - * When should the message be displayed? - * - *
Default implementation returns {@code tomorrow at 00:00:00 GMT}. - * - * @return a future date after which the message should be redisplayed. - */ - public Date getRedisplay() { - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT")); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - cal.add(Calendar.DAY_OF_MONTH, 1); - return cal.getTime(); - } -} diff --git a/java/com/google/gerrit/server/config/GerritGlobalModule.java b/java/com/google/gerrit/server/config/GerritGlobalModule.java index 3b9c40e67f..a7cede66b4 100644 --- a/java/com/google/gerrit/server/config/GerritGlobalModule.java +++ b/java/com/google/gerrit/server/config/GerritGlobalModule.java @@ -61,7 +61,6 @@ import com.google.gerrit.extensions.events.WorkInProgressStateChangedListener; import com.google.gerrit.extensions.registration.DynamicItem; import com.google.gerrit.extensions.registration.DynamicMap; import com.google.gerrit.extensions.registration.DynamicSet; -import com.google.gerrit.extensions.systemstatus.MessageOfTheDay; import com.google.gerrit.extensions.validators.CommentValidator; import com.google.gerrit.extensions.webui.BranchWebLink; import com.google.gerrit.extensions.webui.DiffWebLink; @@ -360,7 +359,6 @@ public class GerritGlobalModule extends FactoryModule { DynamicItem.itemOf(binder(), AvatarProvider.class); DynamicSet.setOf(binder(), LifecycleListener.class); DynamicSet.setOf(binder(), TopMenu.class); - DynamicSet.setOf(binder(), MessageOfTheDay.class); DynamicMap.mapOf(binder(), DownloadScheme.class); DynamicMap.mapOf(binder(), DownloadCommand.class); DynamicMap.mapOf(binder(), CloneCommand.class); diff --git a/java/com/google/gerrit/server/edit/ChangeEditUtil.java b/java/com/google/gerrit/server/edit/ChangeEditUtil.java index 6ba30bffba..ea34b768fc 100644 --- a/java/com/google/gerrit/server/edit/ChangeEditUtil.java +++ b/java/com/google/gerrit/server/edit/ChangeEditUtil.java @@ -168,7 +168,10 @@ public class ChangeEditUtil { RevCommit squashed = squashEdit(rw, oi, edit.getEditCommit(), basePatchSet); PatchSet.Id psId = ChangeUtil.nextPatchSetId(repo, change.currentPatchSetId()); - PatchSetInserter inserter = patchSetInserterFactory.create(notes, psId, squashed); + PatchSetInserter inserter = + patchSetInserterFactory + .create(notes, psId, squashed) + .setSendEmail(!change.isWorkInProgress()); StringBuilder message = new StringBuilder("Patch Set ").append(inserter.getPatchSetId().get()).append(": "); diff --git a/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java b/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java index 72ef981185..f0448aaf64 100644 --- a/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java +++ b/javatests/com/google/gerrit/acceptance/edit/ChangeEditIT.java @@ -142,8 +142,11 @@ public class ChangeEditIT extends AbstractDaemonTest { public void publishEdit() throws Exception { createArbitraryEditFor(changeId); + AddReviewerInput in = new AddReviewerInput(); + in.reviewer = user.email(); + gApi.changes().id(changeId).addReviewer(in); + PublishChangeEditInput publishInput = new PublishChangeEditInput(); - publishInput.notify = NotifyHandling.NONE; gApi.changes().id(changeId).edit().publish(publishInput); assertThat(getEdit(changeId)).isAbsent(); @@ -160,8 +163,10 @@ public class ChangeEditIT extends AbstractDaemonTest { assertThat(info.messages).isNotEmpty(); assertThat(Iterables.getLast(info.messages).tag) .isEqualTo(ChangeMessagesUtil.TAG_UPLOADED_PATCH_SET); + assertThat(sender.getMessages()).isNotEmpty(); // Move the change to WIP, repeat, and verify. + sender.clear(); gApi.changes().id(changeId).setWorkInProgress(); createEmptyEditFor(changeId); gApi.changes().id(changeId).edit().modifyFile(FILE_NAME, RawInputUtil.create(CONTENT_NEW2)); @@ -170,6 +175,7 @@ public class ChangeEditIT extends AbstractDaemonTest { assertThat(info.messages).isNotEmpty(); assertThat(Iterables.getLast(info.messages).tag) .isEqualTo(ChangeMessagesUtil.TAG_UPLOADED_WIP_PATCH_SET); + assertThat(sender.getMessages()).isEmpty(); } @Test diff --git a/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java b/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java index 12fe263985..b822750cfe 100644 --- a/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java +++ b/javatests/com/google/gerrit/acceptance/rest/change/AbstractSubmit.java @@ -57,7 +57,6 @@ import com.google.gerrit.acceptance.testsuite.request.RequestScopeOperations; import com.google.gerrit.common.Nullable; import com.google.gerrit.common.data.Permission; import com.google.gerrit.entities.Account; -import com.google.gerrit.entities.BooleanProjectConfig; import com.google.gerrit.entities.BranchNameKey; import com.google.gerrit.entities.Change; import com.google.gerrit.entities.PatchSet; @@ -645,14 +644,7 @@ public abstract class AbstractSubmit extends AbstractDaemonTest { // | // C0 -- Master // - try (ProjectConfigUpdate u = updateProject(project)) { - u.getConfig() - .getProject() - .setBooleanConfig( - BooleanProjectConfig.CREATE_NEW_CHANGE_FOR_ALL_NOT_IN_TARGET, - InheritableBoolean.TRUE); - u.save(); - } + enableCreateNewChangeForAllNotInTarget(); PushOneCommit push1 = pushFactory.create(admin.newIdent(), testRepo, PushOneCommit.SUBJECT, "a.txt", "content");