From 7c81c21f2d24c83cacb9246454b89ca74e432c73 Mon Sep 17 00:00:00 2001 From: iFixKart Dev Date: Tue, 17 Nov 2026 19:01:25 +0530 Subject: [PATCH] fix(reviews): require admin approval for submitted customer reviews by default --- app/models/ProductReviewModel.py | 4 ++-- app/services/StorefrontService.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/models/ProductReviewModel.py b/app/models/ProductReviewModel.py index 3dafbd3..8b5444c 100644 --- a/app/models/ProductReviewModel.py +++ b/app/models/ProductReviewModel.py @@ -19,7 +19,7 @@ class ProductReview(Base, AuditBaseMixin): title = Column(String(255), nullable=False) comment = Column(Text, nullable=False) verified_purchase = Column(Boolean, default=True, nullable=False) - is_approved = Column(Boolean, default=True, nullable=False, index=True) + is_approved = Column(Boolean, default=False, nullable=False, index=True) helpful_count = Column(Integer, default=0, nullable=False) admin_reply = Column(Text, nullable=True) @@ -33,6 +33,6 @@ class ProductReviewImage(Base, AuditBaseMixin): image_url = Column(String(1000), nullable=False) caption = Column(String(255), nullable=True) display_order = Column(Integer, default=0, nullable=False) - is_approved = Column(Boolean, default=True, nullable=False, index=True) + is_approved = Column(Boolean, default=False, nullable=False, index=True) review = relationship("ProductReview", back_populates="images") diff --git a/app/services/StorefrontService.py b/app/services/StorefrontService.py index 389e718..969aff5 100644 --- a/app/services/StorefrontService.py +++ b/app/services/StorefrontService.py @@ -102,8 +102,9 @@ class StorefrontService: email=author_email ) - # Approved by default if no blocked words, otherwise queued for moderation - is_approved = not contains_blocked + # All customer submitted reviews enter pending moderation (is_approved=False) + # and require admin review before being published. + is_approved = False review = ProductReview( review_id=str(ulid.ULID()),