Add a Restored.vm template and use it.

The restore action has been erroneously using the Abandoned.vm
template.  Create a template and sender for the restore
command.  Refactor some code to make this additonal sender
share much in common with the AbandonedSender.

Change-Id: Id1c61ead7cf71c3476759f0a968f1bf013b77b47
This commit is contained in:
Martin Fick
2011-06-27 10:25:38 -06:00
parent c3a2f83605
commit 7759a6fca6
10 changed files with 139 additions and 33 deletions

View File

@@ -20,7 +20,8 @@ import com.google.inject.assistedinject.Assisted;
/** Send notice about a change being abandoned by its owner. */
public class AbandonedSender extends ReplyToChangeSender {
public static interface Factory {
public static interface Factory extends
ReplyToChangeSender.Factory<AbandonedSender> {
AbandonedSender create(Change change);
}

View File

@@ -18,6 +18,10 @@ import com.google.gerrit.reviewdb.Change;
/** Alert a user to a reply to a change, usually commentary made during review. */
public abstract class ReplyToChangeSender extends ChangeEmail {
public static interface Factory<T extends ReplyToChangeSender> {
public T create(Change change);
}
protected ReplyToChangeSender(EmailArguments ea, Change c, String mc) {
super(ea, c, mc);
}

View File

@@ -0,0 +1,46 @@
// Copyright (C) 2011 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.server.mail;
import com.google.gerrit.reviewdb.Change;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
/** Send notice about a change being restored by its owner. */
public class RestoredSender extends ReplyToChangeSender {
public static interface Factory extends
ReplyToChangeSender.Factory<RestoredSender> {
RestoredSender create(Change change);
}
@Inject
public RestoredSender(EmailArguments ea, @Assisted Change c) {
super(ea, c, "restore");
}
@Override
protected void init() throws EmailException {
super.init();
ccAllApprovals();
bccStarredBy();
bccWatchesNotifyAllComments();
}
@Override
protected void formatChange() throws EmailException {
appendText(velocifyFile("Restored.vm"));
}
}