7d23f225f7
Provides sample plugin that sets Code-Review+1 on entering LGTM into reply dialog. Adds a getLabelValue(labelName) to plugin.changeReply(). Adds support for plugin dom hooks in general, and for reply dialog text area as a first instance. Adds plugin.changeReply().addReplyTextChangedCallback() which uses dom plugin hook. Feature: Issue 6280 Change-Id: I2b8d52c0d8000ea5d217268f6e6d7ef4137b2213
17 lines
469 B
HTML
17 lines
469 B
HTML
<dom-module id="lgtm-plugin">
|
|
<script>
|
|
Gerrit.install(plugin => {
|
|
const replyApi = plugin.changeReply();
|
|
replyApi.addReplyTextChangedCallback(text => {
|
|
const label = 'Code-Review';
|
|
const labelValue = replyApi.getLabelValue(label);
|
|
if (labelValue &&
|
|
labelValue === ' 0' &&
|
|
text.indexOf('LGTM') === 0) {
|
|
replyApi.setLabelValue(label, '+1');
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
</dom-module>
|