Repository navigation
Keep read-only fields of customer groups, product reviews and message templates out of their edit forms (2.4.x) - #1096
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type: bugfix
Issue
A few edit screens posted back values that are shown read-only, and the mapping copied them onto the stored entity:
IsSystem(also in the API, wherePatchchecked the flag after applying the patch);ProductId,CustomerIdandRating— the review totals were then recalculated for the posted product id, also in Approve / Disapprove selected on the list;Name, the key templates are sent by.When a message template form was shown again after a validation error, the Has attached download switch was also reset from the stored attachment instead of keeping the posted value.
Ports #1085, #1086 and #1087 to 2.4.x.
Solution
CustomerGroupModel.IsSystemis[BindNever]and ignored in the admin and API mappings; the APIPatchchecks the stored group.ProductReviewModel.ProductId,CustomerIdandRatingare[BindNever]and ignored in the mapping; bulk approve/disapprove use the stored review's product.Putchecks the stored group too, instead of theIsSystemvalue in the request body. An unknown id returns 404 and an empty id 400. The same change goes to develop in Check the stored customer group before an API update #1108.ProductIdquery string.Breaking changes
None in the UI. API
PUT /CustomerGroupon a system group now returns 400 whateverIsSystemsays in the body.Testing
PUTthe Administrators group withIsSystem: false. Expect 400 and no change.dotnet test src/Tests/Grand.Web.Admin.Tests,src/Tests/Grand.Mapping.Testsandsrc/Tests/Grand.Module.Api.Testspass.