0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Refactored UrlGenerator simplifying conditional logic

no issue

- The logic inside the if/esle conditions was duplicated and made it confusing to reason about.
- This change is not effecting the underlying logic at all
This commit is contained in:
Naz 2020-11-17 13:09:22 +13:00
parent 05e12d4b5a
commit 6268d9c324

View file

@ -161,17 +161,7 @@ class UrlGenerator {
// CASE 1: route has no custom filter, it will own the resource for sure
// CASE 2: find out if my filter matches the resource
if (!this.filter) {
this.urls.add({
url: url,
generatorId: this.uid,
resource: resource
});
resource.reserve();
this._resourceListeners(resource);
return true;
} else if (this.nql.queryJSON(resource.data)) {
if ((!this.filter) || (this.nql.queryJSON(resource.data))) {
this.urls.add({
url: url,
generatorId: this.uid,