From ed0762fb51cf71e3d32a67c735a1c2282c52aee9 Mon Sep 17 00:00:00 2001 From: Michael Barrett Date: Mon, 15 Jan 2024 14:40:01 +0000 Subject: [PATCH] Removed usage of `yg` when using NQL (#19287) refs https://github.com/TryGhost/NQL/pull/73 The referenced PR removes `yg` from the parsed NQL output, so we also need to remove any usage of it in Ghost --- apps/admin-x-settings/package.json | 2 +- ghost/admin/app/components/members/filter.js | 3 --- .../components/members/filters/subscribed.js | 2 +- ghost/admin/package.json | 4 +-- ghost/bookshelf-repository/package.json | 4 +-- ghost/collections/package.json | 2 +- ghost/core/package.json | 2 +- .../package.json | 4 +-- ghost/link-tracking/package.json | 2 +- ghost/members-api/package.json | 2 +- ghost/posts-service/lib/PostsExporter.js | 3 --- ghost/posts-service/package.json | 2 +- yarn.lock | 26 ++++++++++++++++++- 13 files changed, 38 insertions(+), 20 deletions(-) diff --git a/apps/admin-x-settings/package.json b/apps/admin-x-settings/package.json index 6740c1f8f8..11af11b891 100644 --- a/apps/admin-x-settings/package.json +++ b/apps/admin-x-settings/package.json @@ -40,7 +40,7 @@ "@codemirror/lang-html": "^6.4.5", "@tryghost/color-utils": "0.2.0", "@tryghost/limit-service": "^1.2.10", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/timezone-data": "0.4.1", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/ghost/admin/app/components/members/filter.js b/ghost/admin/app/components/members/filter.js index 8f858406e3..cff9618aea 100644 --- a/ghost/admin/app/components/members/filter.js +++ b/ghost/admin/app/components/members/filter.js @@ -342,9 +342,6 @@ export default class MembersFilter extends Component { if (filter.$and) { parsedFilters.push(...this.parseNqlFilters(filter.$and)); - } else if (filter.yg) { - // Single filter grouped in backets - parsedFilters.push(...this.parseNqlFilter(filter.yg)); } else { const filterKeys = Object.keys(filter); const validKeys = this.filterProperties.map(prop => prop.name); diff --git a/ghost/admin/app/components/members/filters/subscribed.js b/ghost/admin/app/components/members/filters/subscribed.js index f849ec4ab3..f825b36231 100644 --- a/ghost/admin/app/components/members/filters/subscribed.js +++ b/ghost/admin/app/components/members/filters/subscribed.js @@ -39,7 +39,7 @@ export const SUBSCRIBED_FILTER = ({newsletters, feature, group}) => { const comparator = flt.$and || flt.$or; // $or for legacy filter backwards compatibility if (!comparator || comparator.length !== 2) { - const filter = flt.yg || flt; + const filter = flt; if (filter && filter.email_disabled !== undefined) { if (filter.email_disabled) { return { diff --git a/ghost/admin/package.json b/ghost/admin/package.json index 19184b3573..73e8546013 100644 --- a/ghost/admin/package.json +++ b/ghost/admin/package.json @@ -49,8 +49,8 @@ "@tryghost/koenig-lexical": "1.0.9", "@tryghost/limit-service": "1.2.12", "@tryghost/members-csv": "0.0.0", - "@tryghost/nql": "0.12.0", - "@tryghost/nql-lang": "0.6.0", + "@tryghost/nql": "0.12.1", + "@tryghost/nql-lang": "0.6.1", "@tryghost/string": "0.2.10", "@tryghost/timezone-data": "0.4.1", "autoprefixer": "9.8.6", diff --git a/ghost/bookshelf-repository/package.json b/ghost/bookshelf-repository/package.json index 287e0d2836..a4f2cd1a98 100644 --- a/ghost/bookshelf-repository/package.json +++ b/ghost/bookshelf-repository/package.json @@ -23,10 +23,10 @@ "c8": "7.14.0", "mocha": "10.2.0", "sinon": "15.2.0", - "@tryghost/nql": "0.12.0" + "@tryghost/nql": "0.12.1" }, "dependencies": { - "@tryghost/mongo-utils": "0.6.0", + "@tryghost/mongo-utils": "0.6.1", "knex": "2.4.2" } } diff --git a/ghost/collections/package.json b/ghost/collections/package.json index 994ed100c3..dc295ec794 100644 --- a/ghost/collections/package.json +++ b/ghost/collections/package.json @@ -30,7 +30,7 @@ "@tryghost/errors": "1.2.26", "@tryghost/in-memory-repository": "0.0.0", "@tryghost/logging": "2.4.8", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/nql-filter-expansions": "0.0.0", "@tryghost/post-events": "0.0.0", "@tryghost/tpl": "0.1.26", diff --git a/ghost/core/package.json b/ghost/core/package.json index d8a13daf0a..6c3508d6cd 100644 --- a/ghost/core/package.json +++ b/ghost/core/package.json @@ -135,7 +135,7 @@ "@tryghost/mw-version-match": "0.0.0", "@tryghost/mw-vhost": "0.0.0", "@tryghost/nodemailer": "0.3.37", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/oembed-service": "0.0.0", "@tryghost/package-json": "0.0.0", "@tryghost/post-revisions": "0.0.0", diff --git a/ghost/custom-theme-settings-service/package.json b/ghost/custom-theme-settings-service/package.json index 4c0b53687b..31daa69cc4 100644 --- a/ghost/custom-theme-settings-service/package.json +++ b/ghost/custom-theme-settings-service/package.json @@ -18,7 +18,7 @@ "lib" ], "devDependencies": { - "@tryghost/nql-lang": "0.6.0", + "@tryghost/nql-lang": "0.6.1", "c8": "8.0.1", "mocha": "10.2.0", "should": "13.2.3", @@ -27,7 +27,7 @@ "dependencies": { "@tryghost/debug": "0.1.26", "@tryghost/errors": "1.2.26", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/tpl": "0.1.26", "lodash": "4.17.21" } diff --git a/ghost/link-tracking/package.json b/ghost/link-tracking/package.json index 1604407b62..761eb2cba6 100644 --- a/ghost/link-tracking/package.json +++ b/ghost/link-tracking/package.json @@ -26,7 +26,7 @@ "dependencies": { "@tryghost/errors": "1.2.26", "@tryghost/link-redirects": "0.0.0", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/tpl": "0.1.26", "bson-objectid": "2.0.4", "lodash": "4.17.21", diff --git a/ghost/members-api/package.json b/ghost/members-api/package.json index 458e1ac287..969861dc19 100644 --- a/ghost/members-api/package.json +++ b/ghost/members-api/package.json @@ -36,7 +36,7 @@ "@tryghost/magic-link": "0.0.0", "@tryghost/member-events": "0.0.0", "@tryghost/members-payments": "0.0.0", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/tpl": "0.1.26", "@tryghost/validator": "0.2.6", "@types/jsonwebtoken": "9.0.5", diff --git a/ghost/posts-service/lib/PostsExporter.js b/ghost/posts-service/lib/PostsExporter.js index 7f8588cf23..7b05b4727f 100644 --- a/ghost/posts-service/lib/PostsExporter.js +++ b/ghost/posts-service/lib/PostsExporter.js @@ -226,9 +226,6 @@ class PostsExporter { for (const subfilter of filter.$or) { strings.push(...this.filterToString(subfilter, allLabels, allTiers)); } - } else if (filter.yg) { - // Single filter grouped in brackets - strings.push(...this.filterToString(filter.yg, allLabels, allTiers)); } else { for (const key of Object.keys(filter)) { if (key === 'label') { diff --git a/ghost/posts-service/package.json b/ghost/posts-service/package.json index 49b9fedcb8..b450b9a73d 100644 --- a/ghost/posts-service/package.json +++ b/ghost/posts-service/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@tryghost/errors": "1.2.26", - "@tryghost/nql": "0.12.0", + "@tryghost/nql": "0.12.1", "@tryghost/post-events": "0.0.0", "@tryghost/tpl": "0.1.26", "bson-objectid": "2.0.4" diff --git a/yarn.lock b/yarn.lock index 585512fe91..3f2e050253 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8096,6 +8096,13 @@ dependencies: lodash "^4.17.11" +"@tryghost/mongo-utils@0.6.1", "@tryghost/mongo-utils@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@tryghost/mongo-utils/-/mongo-utils-0.6.1.tgz#ef5e815ca923d7e3bf450c7a30843f763f68ae74" + integrity sha512-4v1rv5BxqImz8IYcw3Ao4EK2Ym5XY0DB/iGOURV1hkH8cECTbe515xWuR3JSXnB/o4BVZ8I1Wih4h5B0go+whA== + dependencies: + lodash "^4.17.11" + "@tryghost/nodemailer@0.3.37": version "0.3.37" resolved "https://registry.yarnpkg.com/@tryghost/nodemailer/-/nodemailer-0.3.37.tgz#f8766fdc176fec1e5fcfad1ed3c137702f247c83" @@ -8108,7 +8115,14 @@ nodemailer-mailgun-transport "^2.1.5" nodemailer-stub-transport "^1.1.0" -"@tryghost/nql-lang@0.6.0", "@tryghost/nql-lang@^0.6.0": +"@tryghost/nql-lang@0.6.1", "@tryghost/nql-lang@^0.6.1": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@tryghost/nql-lang/-/nql-lang-0.6.1.tgz#830847d71f0b04107f7d20e3ebc91530fa11df16" + integrity sha512-0fYuzWuHXYN0qk3EnqBPv7IQykn6IaFFp1XcY3CtB3nfYZqsJzVGylQFNpxx6dhRLN8ZxdycZ00HkRChd0tvjQ== + dependencies: + date-fns "^2.28.0" + +"@tryghost/nql-lang@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@tryghost/nql-lang/-/nql-lang-0.6.0.tgz#ea9a0ba5e7a141fb7279e94442bf995bb70936da" integrity sha512-8VAUhyA80nTlF/IrinCxw6E3q1Hd2jdpLCE/QqeKa0Q8ISoQ993eOfL9gNAbLc7rmc8GWN2QBYjAW6Xljmjkkw== @@ -8125,6 +8139,16 @@ "@tryghost/nql-lang" "^0.6.0" mingo "^2.2.2" +"@tryghost/nql@0.12.1": + version "0.12.1" + resolved "https://registry.yarnpkg.com/@tryghost/nql/-/nql-0.12.1.tgz#da0deb03b9111ac34d70fb07e5db0c4028251ed2" + integrity sha512-UW3+lhyGW3AuGUAsOGsUr0hpkh1KQ2DlcdtZkN0DzU8Bznd7kR0/afOaOqnOdI257pkYmaP7PgGLXcvwTf27+w== + dependencies: + "@tryghost/mongo-knex" "^0.9.0" + "@tryghost/mongo-utils" "^0.6.1" + "@tryghost/nql-lang" "^0.6.1" + mingo "^2.2.2" + "@tryghost/pretty-cli@1.2.38", "@tryghost/pretty-cli@^1.2.38": version "1.2.38" resolved "https://registry.yarnpkg.com/@tryghost/pretty-cli/-/pretty-cli-1.2.38.tgz#a2844f504dfd841f9f0552769ec3f62239433eca"