fix(reviews): require admin approval for submitted customer reviews by default

This commit is contained in:
iFixKart Dev 2026-11-17 19:01:25 +05:30
parent 4f3163d14c
commit 7c81c21f2d
2 changed files with 5 additions and 4 deletions

View file

@ -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")

View file

@ -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()),