-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add SelectNode and Remove method to JsonDynamicObject class #15509
Conversation
Hi @hishamco @MikeAlhayek , Since the Content property could be of type JsonDynamicObject or JsonObject, do we need to migrate all functions that can be called from JsonObject here? OrchardCore/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentElement.cs Lines 26 to 31 in b83e2dc
|
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Outdated
Show resolved
Hide resolved
…micObject.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…micObject.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
This comment was marked as off-topic.
This comment was marked as off-topic.
This PR can't to fix #15497 , because there was a logical error in the last change |
|
||
// Couldn't find targeted menu item. | ||
if (menuItem == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
menu.Content.Remove(menuItemId); |
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.
Do we have to change the code if Remove
is added in this class?
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.
The problem here is not because of the Remove function, because menu.Content
is a document object, so we can not directly remove a MenuItem
from the document object based on the menuId
The code on the main branch here is wrong
Fixes #15497 too? |
This pull request has merge conflicts. Please resolve those before requesting a review. |
Please resolve the conflict |
This pull request has merge conflicts. Please resolve those before requesting a review. |
Resolved |
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.
Please only request a review when the checks are successful. You have these errors:
Also you didn't address this: https://github.com/OrchardCMS/OrchardCore/pull/15509/files/2e877408abb79e7f6613ce5a091cf918bb99d758#r1534515122
@sarahelsaig updated . |
Given that #15524 was merged, is this still needed? |
Yes, the PR just modify |
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Outdated
Show resolved
Hide resolved
@@ -41,6 +41,10 @@ public class JsonDynamicArray : DynamicObject, IEnumerable<JsonNode?> | |||
} | |||
} | |||
|
|||
public bool Remove(JsonNode? item) => _jsonArray.Remove(item); |
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.
As I mentioned Please update _dictionary
in JsonDynamicArray.Remove
as well.
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.
Updated
…micObject.cs Co-authored-by: Sára El-Saig <[email protected]>
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Abstractions/Json/Dynamic/JsonDynamicObject.cs
Show resolved
Hide resolved
…micObject.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
…micObject.cs Co-authored-by: Hisham Bin Ateya <[email protected]>
@sarahelsaig waiting for your approval if everything looks good for you |
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.
LGTM
@MikeAlhayek is there anything to add or shall we merge this |
Merge it |
try to fix #15505