3ae72b3526
Change-Id: I746ebd99c97d10e921b196ba8d219e50a4f84a2d
24 lines
763 B
HTML
24 lines
763 B
HTML
<dom-module id="suggested-vote">
|
|
<script>
|
|
Gerrit.install(plugin => {
|
|
const replyApi = plugin.changeReply();
|
|
let wasSuggested = false;
|
|
plugin.on('showchange', () => {
|
|
wasSuggested = false;
|
|
});
|
|
const CODE_REVIEW = 'Code-Review';
|
|
replyApi.addLabelValuesChangedCallback(({name, value}) => {
|
|
if (wasSuggested && name === CODE_REVIEW) {
|
|
replyApi.showMessage('');
|
|
wasSuggested = false;
|
|
} else if (replyApi.getLabelValue(CODE_REVIEW) === '+1' &&
|
|
!wasSuggested) {
|
|
replyApi.setLabelValue(CODE_REVIEW, '+2');
|
|
replyApi.showMessage(`Suggested ${CODE_REVIEW} upgrade: +2`);
|
|
wasSuggested = true;
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</dom-module>
|