Skip to content

Commit 8b084b3

Browse files
authored
isEnabled order of check (#533)
We want to validate _first_ for the simplest condition and if that condition is met, we want to perform the other more expensive checks. This avoid raising "Validation error on..." for every page when the version is not external, for example.
1 parent 81ca63b commit 8b084b3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/ethicalads.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ export class EthicalAdsAddon extends AddonBase {
323323

324324
static isEnabled(config, httpStatus) {
325325
return (
326-
super.isEnabled(config, httpStatus) &&
327-
config.addons.ethicalads.ad_free === false
326+
config.addons.ethicalads.ad_free === false &&
327+
super.isEnabled(config, httpStatus)
328328
);
329329
}
330330
}

src/filetreediff.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,10 @@ export class FileTreeDiffAddon extends AddonBase {
344344

345345
static isEnabled(config, httpStatus) {
346346
return (
347-
super.isEnabled(config, httpStatus) &&
348-
config.versions.current.type === "external"
347+
// The order is important since we don't even want to run the data
348+
// validation if the version is not external.
349+
config.versions.current.type === "external" &&
350+
super.isEnabled(config, httpStatus)
349351
);
350352
}
351353
}

0 commit comments

Comments
 (0)