Fire a specific event when a vote is deleted from a change

Currently, removing a vote causes a "comment added" event to be
fired.

Replace it with a specific event. The event contains the approvals
before and after the removal, the removed vote(s), and the message.

Note that while the current implementation of DeleteVote only allows
to delete a single vote, the event allows for multiple removed votes
in case this is implemented in DeleteVote in future.

Change-Id: I8d62dc61c13d231a47d109f544c472d974031f0c
This commit is contained in:
David Pursehouse
2016-07-12 15:27:28 +09:00
parent 2afc472a91
commit 93954dd399
4 changed files with 175 additions and 8 deletions

View File

@@ -0,0 +1,33 @@
// Copyright (C) 2016 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.events;
import com.google.gerrit.extensions.annotations.ExtensionPoint;
import com.google.gerrit.extensions.common.ApprovalInfo;
import java.util.Map;
/** Notified whenever a vote is removed from a change. */
@ExtensionPoint
public interface VoteDeletedListener {
interface Event extends RevisionEvent {
Map<String, ApprovalInfo> getOldApprovals();
Map<String, ApprovalInfo> getApprovals();
Map<String, ApprovalInfo> getRemoved();
String getMessage();
}
void onVoteDeleted(Event event);
}