Repository navigation
Split the product edit tabs out of BaseProductController - #974
Merged
Merged
Conversation
added 13 commits
October 21, 2026 22:25
added 2 commits
October 22, 2026 11:56
InsertAsync stamps CreatedOnUtc with the current time, so the dates the test gave were dropped and posts inserted in the same millisecond came back in any order.
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.
Part of the architecture backlog (item S5: god classes,
BaseProductController)Type: feature
Issue
Grand.Web.AdminShared/Controllers/BaseProductController.cswas 3396 lines with 140 actions and 11 constructor dependencies. Every tab of the product edit screen lived in it, so each panel'sProductController(Admin, Store, Vendor) carried the dependencies of every tab, the 5755-line test file shared one fixture, and any two changes to different tabs collided in the same file.Solution
BaseProduct<Tab>Controllerin AdminShared plus an Admin, Store and Vendor subclass with the same class attributes as that panel'sProductController:ProductCategory,ProductCollectionProductRelated(related, similar, cross-sell, recommended),ProductBundle,ProductAssociatedProductPicture,ProductSpecificationProductPrice(currency prices, tier prices)ProductAttributeMapping(attributes, conditions, attribute values),ProductAttributeCombination(combinations and their tier prices)ProductReservation,ProductBid[PermissionAuthorize(PermissionSystemName.Products)]and[AutoValidateAntiforgeryToken]and takes only the services its actions use. Action bodies moved unchanged.ProductControllerkeeps list, create, edit, delete, copy, required products, purchased with orders, reviews, export/import and bulk edit.BaseProductControlleris down to 685 lines and 7 dependencies.Invalid*AddPopupResultto Vendor'sProductRelatedControllerandProductBundleController,AssociatedProductVendorId(and theIContextAccessorit needs) to Vendor'sProductAssociatedController.Views/AdminShared/<Controller>/(AttributeCombinationPopupin each panel'sAreas/<Panel>/Views/ProductAttributeCombination/). The partials only those popups use moved with them:CreateOrUpdateTierPrice,TierPrice.StoreScope(including Vendor's override),WidgetZone.TierPrice.*,CreateOrUpdateProductAttributeValue,WidgetZone.AttributeValueButtons,ProductAttributes. The edit tabs point theirUrl.Action/asp-controllerat the new controllers.BaseProductControllerTestsbecameProductControllerTestsBase<TController>, and each tab's tests moved toBaseProduct<Tab>ControllerTestsunchanged. The panel attribute tests now run over all 13 product controllers, and a Vendor test checks that each Vendor hook is overridden where the action now lives (a lost override would compile and silently fall back to the Admin/Store behavior).Breaking changes
/Admin/Product/ProductPictureListis now/Admin/ProductPicture/ProductPictureList, and so on for every action listed above. A theme or plugin that links to one of these actions through"Product", or calls the URL directly, gets a 404 until it uses the new controller name.Views/Product/is no longer picked up; it has to move to the new controller's folder.BaseProductController's constructor lostIInventoryManageService,IProductReservationService,IAuctionServiceandIEnumTranslationService, and its tab actions and protected hooks moved to the new base controllers. Code outside this repository that subclasses it must follow.Testing
dotnet build GrandNode.slnx: no errors, no warnings in the files this PR changes.dotnet testforGrand.Web.Admin.Tests(1592),Grand.Web.Store.Tests(181) andGrand.Web.Vendor.Tests(53) pass. Before the change: 1580 / 169 / 35; the difference is only the new attribute and Vendor hook tests. No assertion was removed or weakened.