Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

fix(store): drop dead-condition re-check in EditWarningCheck across Product/Collection/Brand/Category/Blog (#811)

Krzysztof Pajake79754f0f7b2
diff --git a/src/Web/Grand.Web.Store/Controllers/BlogController.cs b/src/Web/Grand.Web.Store/Controllers/BlogController.cs
index 368dbb8cf..8b2284667 100644
--- a/src/Web/Grand.Web.Store/Controllers/BlogController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/BlogController.cs
@@ -46,8 +46,7 @@ public class BlogController(
protected override void EditWarningCheck(BlogPost blogPost)
{
if (!blogPost.LimitedToStores ||
- (blogPost.LimitedToStores &&
- blogPost.Stores.Contains(PostScope.DefaultStoreId) &&
+ (blogPost.Stores.Contains(PostScope.DefaultStoreId) &&
blogPost.Stores.Count > 1))
Warning(TranslationService.GetResource("Admin.Content.Blog.BlogPosts.Permissions"));
}
diff --git a/src/Web/Grand.Web.Store/Controllers/BrandController.cs b/src/Web/Grand.Web.Store/Controllers/BrandController.cs
index fab1d1183..dfffaec76 100644
--- a/src/Web/Grand.Web.Store/Controllers/BrandController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/BrandController.cs
@@ -38,8 +38,7 @@ public class BrandController(
protected override void EditWarningCheck(Brand brand)
{
if (!brand.LimitedToStores ||
- (brand.LimitedToStores &&
- brand.Stores.Contains(Scope.DefaultStoreId) &&
+ (brand.Stores.Contains(Scope.DefaultStoreId) &&
brand.Stores.Count > 1))
Warning(TranslationService.GetResource("Admin.Catalog.Brands.Permissions"));
}
diff --git a/src/Web/Grand.Web.Store/Controllers/CategoryController.cs b/src/Web/Grand.Web.Store/Controllers/CategoryController.cs
index adeec3876..68fceb5e3 100644
--- a/src/Web/Grand.Web.Store/Controllers/CategoryController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/CategoryController.cs
@@ -38,8 +38,7 @@ public class CategoryController(
protected override void EditWarningCheck(Category category)
{
if (!category.LimitedToStores ||
- (category.LimitedToStores &&
- category.Stores.Contains(Scope.DefaultStoreId) &&
+ (category.Stores.Contains(Scope.DefaultStoreId) &&
category.Stores.Count > 1))
Warning(TranslationService.GetResource("Admin.Catalog.Categories.Permissions"));
}
diff --git a/src/Web/Grand.Web.Store/Controllers/CollectionController.cs b/src/Web/Grand.Web.Store/Controllers/CollectionController.cs
index 347fb0f3f..579388e4f 100644
--- a/src/Web/Grand.Web.Store/Controllers/CollectionController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/CollectionController.cs
@@ -40,8 +40,7 @@ public class CollectionController(
protected override void EditWarningCheck(Collection collection)
{
if (!collection.LimitedToStores ||
- (collection.LimitedToStores &&
- collection.Stores.Contains(Scope.DefaultStoreId) &&
+ (collection.Stores.Contains(Scope.DefaultStoreId) &&
collection.Stores.Count > 1))
Warning(TranslationService.GetResource("Admin.Catalog.Collections.Permissions"));
}
diff --git a/src/Web/Grand.Web.Store/Controllers/ProductController.cs b/src/Web/Grand.Web.Store/Controllers/ProductController.cs
index bc24fa730..4a2a5a1e7 100644
--- a/src/Web/Grand.Web.Store/Controllers/ProductController.cs
+++ b/src/Web/Grand.Web.Store/Controllers/ProductController.cs
@@ -50,8 +50,7 @@ public class ProductController(
protected override void EditWarningCheck(Product product)
{
if (!product.LimitedToStores ||
- (product.LimitedToStores &&
- product.Stores.Contains(Scope.DefaultStoreId) &&
+ (product.Stores.Contains(Scope.DefaultStoreId) &&
product.Stores.Count > 1))
Warning(TranslationService.GetResource("Admin.Catalog.Products.Permissions"));
}