This is an automated email from the git hooks/post-receive script. New change to branch master in repository oipf-stub. See https://gitlab.nuiton.org/codelutin/oipf-stub.git from ff56fef [JsonTvProvider] - Adding a default endpoint for json format new bea6781 Fix Collection and ScheduleRecording - Collection : fix constructor to take into account real Array signature and - ScheduleRecording : constructor (dont put a channel business object as internal representation of the channel business itself) and also fix toJSON to avoid mutation The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit bea678119680798c12c14816cb6de43a4681dd41 Author: Samuel Maisonneuve <maisonneuve@codelutin.com> Date: Thu Feb 1 10:16:35 2018 +0100 Fix Collection and ScheduleRecording - Collection : fix constructor to take into account real Array signature and - ScheduleRecording : constructor (dont put a channel business object as internal representation of the channel business itself) and also fix toJSON to avoid mutation Summary of changes: src/recording/ScheduledRecording.js | 8 ++++++-- src/shared/Collection.js | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) -- To stop receiving notification emails like this one, please contact SCM administrator <admin+scm@forge.codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch master in repository oipf-stub. See https://gitlab.nuiton.org/codelutin/oipf-stub.git commit bea678119680798c12c14816cb6de43a4681dd41 Author: Samuel Maisonneuve <maisonneuve@codelutin.com> Date: Thu Feb 1 10:16:35 2018 +0100 Fix Collection and ScheduleRecording - Collection : fix constructor to take into account real Array signature and - ScheduleRecording : constructor (dont put a channel business object as internal representation of the channel business itself) and also fix toJSON to avoid mutation --- src/recording/ScheduledRecording.js | 8 ++++++-- src/shared/Collection.js | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/recording/ScheduledRecording.js b/src/recording/ScheduledRecording.js index ac45c4e..827db50 100644 --- a/src/recording/ScheduledRecording.js +++ b/src/recording/ScheduledRecording.js @@ -37,7 +37,11 @@ module.exports = function(ctx) { ctx.__internal__.init(this); this.__internal__.setValues(values); - values.channel && this.__internal__.setField("channel", new Channel(0, values.channel)); + + // If values.channel is a raw object we convert it to the corresponding business object + if (values.channel && values.channel.__internal__ == null) { + this.__internal__.setField("channel", new Channel(0, values.channel)); + } // Recording has been newly scheduled. this.RECORDING_SCHEDULED = 0; @@ -344,7 +348,7 @@ module.exports = function(ctx) { // to json is used because getter are not enumerable in ES6 classes toJSON() { - let result = this.__internal__.getValues(); + let result = Object.assign({}, this.__internal__.getValues()); if (this.channel) { result.channel = this.channel.toJSON(); } diff --git a/src/shared/Collection.js b/src/shared/Collection.js index c04c3f2..91c227b 100644 --- a/src/shared/Collection.js +++ b/src/shared/Collection.js @@ -21,7 +21,13 @@ module.exports = function() { constructor(values) { super(); - values && this.push.apply(this, values); + + // An Array constructor can receive either a list of element or the size of the array. + // (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Obj...) + // Which means we need to filter out the case where the argument represents the length of the array... + if (!Number.isInteger(values)) { + this.push.apply(this, values); + } } item(index) { -- To stop receiving notification emails like this one, please contact SCM administrator <admin+scm@forge.codelutin.com>.
participants (1)
-
scm