Line data Source code
1 : // Copyright (C) 2016 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 vote that was removed from a change. */ 25 : public class DeleteVoteSender extends ReplyToChangeSender { 26 : public interface Factory extends ReplyToChangeSender.Factory<DeleteVoteSender> { 27 : @Override 28 : DeleteVoteSender create(Project.NameKey project, Change.Id changeId); 29 : } 30 : 31 : @Inject 32 : protected DeleteVoteSender( 33 : EmailArguments args, @Assisted Project.NameKey project, @Assisted Change.Id changeId) { 34 9 : super(args, "deleteVote", newChangeData(args, project, changeId)); 35 9 : } 36 : 37 : @Override 38 : protected void init() throws EmailException { 39 9 : super.init(); 40 : 41 9 : ccAllApprovals(); 42 9 : bccStarredBy(); 43 9 : includeWatchers(NotifyType.ALL_COMMENTS); 44 9 : } 45 : 46 : @Override 47 : protected void formatChange() throws EmailException { 48 9 : appendText(textTemplate("DeleteVote")); 49 9 : if (useHtml()) { 50 9 : appendHtml(soyHtmlTemplate("DeleteVoteHtml")); 51 : } 52 9 : } 53 : }