-
Notifications
You must be signed in to change notification settings - Fork 798
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
[backend] improved code comments (#1536) #6940
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6940 +/- ##
=======================================
Coverage 67.42% 67.42%
=======================================
Files 561 561
Lines 68510 68518 +8
Branches 5713 5714 +1
=======================================
+ Hits 46191 46199 +8
Misses 22319 22319 ☔ View full report in Codecov by Sentry. |
// only hint the first 3 ones | ||
let name = extractRepresentative(targetsFromTrash[0]).main; | ||
if (targetsFromTrash.length > 1) name = `${name},${extractRepresentative(targetsFromTrash[1]).main}`; | ||
if (targetsFromTrash.length > 2) name = `${name},${extractRepresentative(targetsFromTrash[2]).main}`; |
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.
I think this can be simplified like this :
let name = targetsFromTrash.slice(0, 3).map((t) => extractRepresentative(t).main).join(',');
if (targetsFromTrash.length > 3) name = `${name}, ... and ${targetsFromTrash.length - 3} more`;
With a suggestion to display the number of other entities with ', ... and X more'
@@ -39,6 +39,9 @@ export const stixDelete = async (context, user, id) => { | |||
const element = await internalLoadById(context, user, id); | |||
if (element) { | |||
if (isStixObject(element.entity_type) || isStixRelationship(element.entity_type)) { | |||
// To handle delete synchronization events, we force the forceDelete flag to true, because we don't want delete events to create trash entries on synchronized platforms | |||
// THIS IS NOT IDEAL: we ideally would need to add the forceDelete flag to all delete related methods on the API, |
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.
shall we open a new issue to "extend gql API/client-python deletion functions with forceDelete option" and keep track of it for the product team ?
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.
that's a good idea yes, I'll create the issue
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.
created the issue here #6969
const name = extractRepresentative(targetsFromTrash[0]); // only hint the first one | ||
throw FunctionalError(`Cannot restore: a relationship targets a deleted element [${name.main}], restore it before retrying`); | ||
// only hint the first 3 ones | ||
let name = targetsFromTrash.slice(0, 3).map((t) => extractRepresentative(t).main).join(','); |
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.
let name = targetsFromTrash.slice(0, 3).map((t) => extractRepresentative(t).main).join(','); | |
let name = targetsFromTrash.slice(0, 3).map((t) => extractRepresentative(t).main).join(', '); |
Proposed changes
Related issues
Checklist
Further comments