Repository navigation
Keep the product, customer and rating of a review out of the edit form - #1086
Merged
Merged
Conversation
The edit form posted ProductId back (hidden input and route value) and the profile mapped ProductId, CustomerId and Rating onto the stored review. They were not saved, but the review totals were recalculated and the redirect built for the posted product, so a changed or empty ProductId left the real product's totals stale or failed the save.
ApproveSelected and DisapproveSelected took the product id from the "reviewId:productId" pair the list posts, so another product's totals could be recalculated while the review's own product kept stale ones, and an unknown id failed after the review was saved. The product now comes from the stored review. The edit form no longer carries a ProductId route value nothing reads, and the mapping snapshot no longer sets fields it ignores.
This was referenced Nov 23, 2026
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
ProductReviewModel.ProductIdreached the edit POST from a hidden input and from theProductIdroute value, andProductReviewProfilemappedProductId,CustomerIdandRatingonto the stored review.ProductReviewService.UpdateProductReviewdoes not save those fields, butProductReviewViewModelService.UpdateProductReviewthen recalculates the review totals forproductReview.ProductId— the posted value — and the controller redirects to it. With a changedProductIdthe totals of the review's own product are not refreshed (e.g. after approving it) and another product's totals are recalculated instead; with an empty one the product is not found.Applies to Admin, Store and Vendor, which share
BaseProductReviewController.Solution
ProductId,CustomerIdandRatingare facts of the review:[BindNever]on the model and ignored in the model → entity map, so the stored review keeps them.ProductIdinput and the unusedProductIdroute value on the form are removed; the edit page still shows and links the product.reviewId:productIdpair; they now use the stored review's product, so an unknown id no longer fails after the review was saved.Breaking changes
None. The three fields were never editable in the UI.
Testing
ProductIdin the form action URL / hidden field to another product id: the review's own product is updated and the other product is untouched.dotnet test src/Tests/Grand.Mapping.Testsanddotnet test src/Tests/Grand.Web.Admin.Tests --filter ProductReviewpass.