-
Notifications
You must be signed in to change notification settings - Fork 2
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
adds method to sort all documents and pages #101
base: main
Are you sure you want to change the base?
Conversation
@@ -133,7 +170,7 @@ module.exports = self => { | |||
$in: publishedIds | |||
} | |||
}) | |||
.relationships(includeRelationships) | |||
.relationships(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded since we get related docs manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoiding the redundant call should be a nice little perf win then.
@@ -121,7 +158,7 @@ module.exports = self => { | |||
$in: draftIds | |||
} | |||
}) | |||
.relationships(includeRelationships) | |||
.relationships(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unneeded since we get related docs manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC issue: someone may have overridden this method, so please check for 5 arguments and if there are five, accept them that way too, ignoring the redundant parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Riiiight BC, always forget that. Would be so good to have a public API, and internal methods that shouldn't be updated by users.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good strategy, minor issue.
lib/methods/export.js
Outdated
@@ -7,7 +7,7 @@ const { uniqBy, uniqueId } = require('lodash'); | |||
|
|||
const MAX_RECURSION = 10; | |||
|
|||
module.exports = self => { | |||
module.exports = (self) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any special reason? (I don't object)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None, for consistency, I thought we used to do this way. But not in this project, reverting.
@@ -33,9 +33,11 @@ module.exports = self => { | |||
|
|||
const hasRelatedTypes = !!relatedTypes.length; | |||
|
|||
const docs = (await self.getDocs(req, ids, hasRelatedTypes, manager, reporting)) | |||
const docs = (await self.getDocs(req, ids, manager, reporting)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we do not get relationships whatever if export related docs
has been checked or no, we don't need this param anymore.
@@ -121,7 +158,7 @@ module.exports = self => { | |||
$in: draftIds | |||
} | |||
}) | |||
.relationships(includeRelationships) | |||
.relationships(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BC issue: someone may have overridden this method, so please check for 5 arguments and if there are five, accept them that way too, ignoring the redundant parameter.
@@ -133,7 +170,7 @@ module.exports = self => { | |||
$in: publishedIds | |||
} | |||
}) | |||
.relationships(includeRelationships) | |||
.relationships(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoiding the redundant call should be a nice little perf win then.
return relatedTypes.some(type => { | ||
const module = self.apos.modules[type]; | ||
return self.apos.instanceOf(module, '@apostrophecms/page-type'); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@boutell I can move this function in a utils file if you think it makes no sense to attach it to self (which I would agree with I think).
PRO-6827
Summary
Fixes page hierarchy not being respected during import.
Sort exported documents as well as their related documents.
What are the specific steps to test this change?
For example:
What kind of change does this PR introduce?
Make sure the PR fulfills these requirements: