Skip to content

Commit 6e47972

Browse files
orgadsalcroito
authored andcommitted
Adapt button modifications to Gerrit v3.1.4 API
labelchanged is fired too early. new show-revision-actions event was added. See https://crbug.com/gerrit/12051 Change-Id: Iba1a939107c2038302d8b84cb7ae8719a363123c Reviewed-by: Jukka Jokiniva <[email protected]> Reviewed-by: Paul Wicking <[email protected]>
1 parent c931f4b commit 6e47972

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

qt-gerrit-ui-plugin/qt-gerrit-ui-plugin.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
});
106106

107107
// Customize change view
108-
plugin.on('labelchange', function(changeInfo) {
108+
plugin.on('show-revision-actions', function(actions, changeInfo) {
109109
plugin.ca = plugin.changeActions();
110110

111111
// always hide the rebase button
@@ -132,7 +132,7 @@
132132

133133
// Add buttons based on server response
134134
BUTTONS.forEach((key) => {
135-
var action = plugin.ca.getActionDetails(key);
135+
var action = actions[key];
136136
if (action) {
137137
// hide dropdown action
138138
plugin.ca.setActionHidden(action.__type, action.__key, true);
@@ -146,7 +146,7 @@
146146
// use the submit icon for our stage button
147147
plugin.ca.setIcon(plugin.buttons[key], 'submit');
148148
// hide submit button when it would be disabled next to the stage button
149-
let submit = plugin.ca.getActionDetails('submit');
149+
let submit = actions['submit'];
150150
if (!submit.enabled) {
151151
plugin.ca.setActionHidden('revision', 'submit', true);
152152
}
@@ -161,7 +161,7 @@
161161
var button_index;
162162
for (var k in plugin.buttons) {
163163
if (plugin.buttons[k] === button_key) {
164-
button_action = plugin.ca.getActionDetails(k);
164+
button_action = actions[k];
165165
button_index = k;
166166
break;
167167
}

0 commit comments

Comments
 (0)