From 8173a037444ec0625b3b9760123d2d2e7a9e160d Mon Sep 17 00:00:00 2001 From: bmac Date: Mon, 18 Dec 2017 14:20:38 -0500 Subject: [PATCH] Remove deprecation around shouldSerializeHasMany --- addon/serializers/json-api.js | 6 +--- addon/serializers/json.js | 28 +------------------ config/features.json | 1 - .../serializers/json-serializer-test.js | 10 ------- 4 files changed, 2 insertions(+), 43 deletions(-) diff --git a/addon/serializers/json-api.js b/addon/serializers/json-api.js index 132d1d2b94c..6f410fa5881 100644 --- a/addon/serializers/json-api.js +++ b/addon/serializers/json-api.js @@ -597,12 +597,8 @@ const JSONAPISerializer = JSONSerializer.extend({ serializeHasMany(snapshot, json, relationship) { let key = relationship.key; - let shouldSerializeHasMany = '_shouldSerializeHasMany'; - if (isEnabled("ds-check-should-serialize-relationships")) { - shouldSerializeHasMany = 'shouldSerializeHasMany'; - } - if (this[shouldSerializeHasMany](snapshot, key, relationship)) { + if (this.shouldSerializeHasMany(snapshot, key, relationship)) { let hasMany = snapshot.hasMany(key); if (hasMany !== undefined) { diff --git a/addon/serializers/json.js b/addon/serializers/json.js index 1008ca381d7..1970d21dcb5 100644 --- a/addon/serializers/json.js +++ b/addon/serializers/json.js @@ -846,29 +846,7 @@ const JSONSerializer = Serializer.extend({ @param {String} relationshipType @return {boolean} true if the hasMany relationship should be serialized */ - shouldSerializeHasMany(snapshot, key, relationship) { - if ((this._shouldSerializeHasMany !== JSONSerializer.prototype._shouldSerializeHasMany)) { - deprecate('The private method _shouldSerializeHasMany has been promoted to the public API. Please remove the underscore to use the public shouldSerializeHasMany method.', false, { - id: 'ds.serializer.private-should-serialize-has-many', - until: '3.0.0' - }); - } - - return this._shouldSerializeHasMany(snapshot, key, relationship); - }, - - /** - Check if the given hasMany relationship should be serialized - - @method _shouldSerializeHasMany - @private - @param {DS.Snapshot} snapshot - @param {String} key - @param {String} relationshipType - @return {boolean} true if the hasMany relationship should be serialized - */ - _shouldSerializeHasMany(snapshot, key, relationship) { let relationshipType = snapshot.type.determineRelationshipType(relationship, this.store); if (this._mustSerialize(key)) { return true; @@ -1219,12 +1197,8 @@ const JSONSerializer = Serializer.extend({ */ serializeHasMany(snapshot, json, relationship) { let key = relationship.key; - let shouldSerializeHasMany = '_shouldSerializeHasMany'; - if (isEnabled("ds-check-should-serialize-relationships")) { - shouldSerializeHasMany = 'shouldSerializeHasMany'; - } - if (this[shouldSerializeHasMany](snapshot, key, relationship)) { + if (this.shouldSerializeHasMany(snapshot, key, relationship)) { let hasMany = snapshot.hasMany(key, { ids: true }); if (hasMany !== undefined) { // if provided, use the mapping provided by `attrs` in diff --git a/config/features.json b/config/features.json index ecff8f33518..e7bcedaf466 100644 --- a/config/features.json +++ b/config/features.json @@ -3,7 +3,6 @@ "ds-pushpayload-return": null, "ds-overhaul-references": null, "ds-payload-type-hooks": null, - "ds-check-should-serialize-relationships": true, "ds-rollback-attribute": null, "ds-serialize-id": null, "ds-deprecate-store-serialize": true diff --git a/tests/integration/serializers/json-serializer-test.js b/tests/integration/serializers/json-serializer-test.js index 920e6064adf..9e13bef9304 100644 --- a/tests/integration/serializers/json-serializer-test.js +++ b/tests/integration/serializers/json-serializer-test.js @@ -291,16 +291,6 @@ test("shouldSerializeHasMany", function(assert) { assert.ok(shouldSerialize, 'shouldSerializeHasMany correctly identifies with hasMany relationship'); }); -if (isEnabled("ds-check-should-serialize-relationships")) { - testInDebug("_shouldSerializeHasMany deprecation", function(assert) { - env.store.serializerFor("post")._shouldSerializeHasMany = function() {}; - - assert.expectDeprecation(function() { - env.store.serializerFor("post").shouldSerializeHasMany(); - }, /_shouldSerializeHasMany has been promoted to the public API/); - }); -} - test("serializeIntoHash", function(assert) { run(() => { post = env.store.createRecord('post', { title: "Rails is omakase", comments: [] });