Line data Source code
1 : // Copyright (C) 2011 The Android Open Source Project 2 : // 3 : // Licensed under the Apache License, Version 2.0 (the "License"); 4 : // you may not use this file except in compliance with the License. 5 : // You may obtain a copy of the License at 6 : // 7 : // http://www.apache.org/licenses/LICENSE-2.0 8 : // 9 : // Unless required by applicable law or agreed to in writing, software 10 : // distributed under the License is distributed on an "AS IS" BASIS, 11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 : // See the License for the specific language governing permissions and 13 : // limitations under the License. 14 : 15 : package com.google.gerrit.server.mail.send; 16 : 17 : import com.google.gerrit.entities.Change; 18 : import com.google.gerrit.entities.NotifyConfig.NotifyType; 19 : import com.google.gerrit.entities.Project; 20 : import com.google.gerrit.exceptions.EmailException; 21 : import com.google.inject.Inject; 22 : import com.google.inject.assistedinject.Assisted; 23 : 24 : /** Send notice about a change being reverted. */ 25 : public class RevertedSender extends ReplyToChangeSender { 26 : public interface Factory { 27 : RevertedSender create(Project.NameKey project, Change.Id changeId); 28 : } 29 : 30 : @Inject 31 : public RevertedSender( 32 : EmailArguments args, @Assisted Project.NameKey project, @Assisted Change.Id changeId) { 33 14 : super(args, "revert", ChangeEmail.newChangeData(args, project, changeId)); 34 14 : } 35 : 36 : @Override 37 : protected void init() throws EmailException { 38 14 : super.init(); 39 : 40 14 : ccAllApprovals(); 41 14 : bccStarredBy(); 42 14 : includeWatchers(NotifyType.ALL_COMMENTS); 43 14 : } 44 : 45 : @Override 46 : protected void formatChange() throws EmailException { 47 14 : appendText(textTemplate("Reverted")); 48 14 : if (useHtml()) { 49 14 : appendHtml(soyHtmlTemplate("RevertedHtml")); 50 : } 51 14 : } 52 : }