DEV: Only patch bootbox methods once in tests (#19222)

We were re-patching the deprecated bootbox methods during every app initialization, which would lead to hundreds of deprecation messages being printed for a single invocation.
This commit is contained in:
David Taylor 2022-11-28 18:14:35 +00:00 committed by GitHub
parent 7a8e018965
commit 7e504a1489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -3,9 +3,15 @@ import bootbox from "bootbox";
import { getOwner } from "discourse-common/lib/get-owner";
import deprecated from "discourse-common/lib/deprecated";
let jqueryPluginsConfigured = false;
export default {
name: "jquery-plugins",
initialize() {
if (jqueryPluginsConfigured) {
return;
}
// Settings for bootbox
bootbox.animate(false);
bootbox.backdrop(true);
@ -46,5 +52,7 @@ export default {
// Initialize the autocomplete tool
$.fn.autocomplete = autocomplete;
jqueryPluginsConfigured = true;
},
};