Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ability to notify and update url service about changes in related resources #10336

Merged
merged 18 commits into from
Jan 8, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions core/test/unit/services/url/Resources_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ describe('Unit: services/url/Resources', function () {

should.exist(resources.getByIdAndType(options.eventData.type, options.eventData.id));
obj.tags.length.should.eql(1);
Object.keys(obj.tags[0]).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.tags[0]).sort().should.eql(['id', 'post_id', 'slug', 'visibility'].sort());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

withRelatedFields doesn't contain these fields, will look into the code itself to confirm why they are being returned here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a little investigation, looks like there is a bug in the current implementation of raw_knex.fetchAll in the base model where these fields are not properly filtered on related tables. @kirrg001 I propose fixing this in a separate issue to be able to merge these changes sooner?

obj.authors.length.should.eql(1);
Object.keys(obj.authors[0]).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.authors[0]).sort().should.eql(['id', 'post_id', 'slug'].sort());
should.exist(obj.primary_author);
Object.keys(obj.primary_author).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.primary_author).sort().should.eql(['id', 'post_id', 'slug'].sort());
should.exist(obj.primary_tag);
Object.keys(obj.primary_tag).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.primary_tag).sort().should.eql(['id', 'post_id', 'slug', 'visibility'].sort());
done();
});

Expand Down Expand Up @@ -205,13 +205,13 @@ describe('Unit: services/url/Resources', function () {
].sort());

should.exist(obj.tags);
Object.keys(obj.tags[0]).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.tags[0]).sort().should.eql(['id', 'post_id', 'slug', 'visibility'].sort());
should.exist(obj.authors);
Object.keys(obj.authors[0]).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.authors[0]).sort().should.eql(['id', 'post_id', 'slug'].sort());
should.exist(obj.primary_author);
Object.keys(obj.primary_author).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.primary_author).sort().should.eql(['id', 'post_id', 'slug'].sort());
should.exist(obj.primary_tag);
Object.keys(obj.primary_tag).sort().should.eql(['id', 'slug'].sort());
Object.keys(obj.primary_tag).sort().should.eql(['id', 'post_id', 'slug', 'visibility'].sort());

done();
});
Expand Down