Fix buttons in proxy redirect notification box

This commit is contained in:
Dan Stillman 2016-04-16 14:22:11 -04:00
parent 0fca78bb7e
commit d8850b25c2

View File

@ -134,7 +134,13 @@ Zotero.Proxies = new function() {
browser, browser,
window, window,
Zotero.getString('proxies.notification.associated.label', [host, channel.URI.hostPort]), Zotero.getString('proxies.notification.associated.label', [host, channel.URI.hostPort]),
[{ label: "proxies.notification.settings.button", callback: function() { _prefsOpenCallback(bw[1]); } }]); [
{
label: "proxies.notification.settings.button",
callback: () => _prefsOpenCallback(window)
}
]
);
} }
} else { } else {
if (!browser) return; if (!browser) return;
@ -263,9 +269,16 @@ Zotero.Proxies = new function() {
window, window,
Zotero.getString('proxies.notification.redirected.label', [channel.URI.hostPort, proxiedURI.hostPort]), Zotero.getString('proxies.notification.redirected.label', [channel.URI.hostPort, proxiedURI.hostPort]),
[ [
{ label: "general.dontShowAgain", callback: function() { _disableRedirectNotification(); } }, {
{ label: "proxies.notification.settings.button", callback: function() { _prefsOpenCallback(bw[1]); } } label: "general.dontShowAgain",
]); callback: () => _disableRedirectNotification()
},
{
label: "proxies.notification.settings.button",
callback: () => _prefsOpenCallback(window)
}
]
);
} }
browser.loadURIWithFlags(proxied, 0, channel.URI, null, null); browser.loadURIWithFlags(proxied, 0, channel.URI, null, null);
@ -464,11 +477,13 @@ Zotero.Proxies = new function() {
/** /**
* Show a proxy-related notification * Show a proxy-related notification
* @param {Array} bw output of _getBrowserWindow * @param {Browser} browser
* @param {String} label notification text * @param {Window} window
* @param {Array} buttons dicts of button label resource string and associated callback * @param {String} label - notification text
* @param {Object[]} buttons - Array of objects with 'label' (for getString()) and 'callback'
*/ */
function _showNotification(browser, window, label, buttons) { function _showNotification(browser, window, label, buttons) {
// Get localized button labels
buttons = buttons.map(function(button) { buttons = buttons.map(function(button) {
return { return {
label: Zotero.getString(button.label), label: Zotero.getString(button.label),