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

fix owners patch issue #17900

Merged
merged 7 commits into from
Sep 20, 2024
Merged

fix owners patch issue #17900

merged 7 commits into from
Sep 20, 2024

Conversation

mohityadav766
Copy link
Contributor

@mohityadav766 mohityadav766 commented Sep 18, 2024

Describe your changes:

Fixes Owner Patch Issue :-

if (nullOrEmpty(owners)) {
       return;
     }
     // populate owner entityRefs with all fields
     List<EntityReference> refs = validateOwners(owners);
     if (nullOrEmpty(refs)) {
       return;
     }
     refs.sort(Comparator.comparing(EntityReference::getName));
     owners.sort(Comparator.comparing(EntityReference::getName));

     for (int i = 0; i < owners.size(); i++) {
       EntityUtil.copy(refs.get(i), owners.get(i));
     }

The issue above is we have the populated details in refs , but we again copy the ref from owners , which can run into issue , since it can only have id and type .
For example owner.sort will itself run into issues , if the id and type are only supplied and we are trying to sort on name

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed.

sonika-shah
sonika-shah previously approved these changes Sep 18, 2024
ayush-shah
ayush-shah previously approved these changes Sep 18, 2024
harshach
harshach previously approved these changes Sep 19, 2024
chirag-madlani
chirag-madlani previously approved these changes Sep 19, 2024
@mohityadav766 mohityadav766 merged commit f4ce0e8 into main Sep 20, 2024
8 of 16 checks passed
@mohityadav766 mohityadav766 deleted the fix-owners-patch branch September 20, 2024 06:11
mohityadav766 added a commit that referenced this pull request Sep 20, 2024
* fix owners patch issue

* rename func

* typo

* Add Test Case

* Fix Tests

---------

Co-authored-by: Sriharsha Chintalapani <harshach@users.noreply.github.com>
Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
(cherry picked from commit f4ce0e8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend customer safe to test Add this label to run secure Github workflows on PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants