fix(reviews): require admin approval for submitted customer reviews by default
This commit is contained in:
parent
4f3163d14c
commit
7c81c21f2d
2 changed files with 5 additions and 4 deletions
|
|
@ -19,7 +19,7 @@ class ProductReview(Base, AuditBaseMixin):
|
||||||
title = Column(String(255), nullable=False)
|
title = Column(String(255), nullable=False)
|
||||||
comment = Column(Text, nullable=False)
|
comment = Column(Text, nullable=False)
|
||||||
verified_purchase = Column(Boolean, default=True, 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)
|
helpful_count = Column(Integer, default=0, nullable=False)
|
||||||
admin_reply = Column(Text, nullable=True)
|
admin_reply = Column(Text, nullable=True)
|
||||||
|
|
||||||
|
|
@ -33,6 +33,6 @@ class ProductReviewImage(Base, AuditBaseMixin):
|
||||||
image_url = Column(String(1000), nullable=False)
|
image_url = Column(String(1000), nullable=False)
|
||||||
caption = Column(String(255), nullable=True)
|
caption = Column(String(255), nullable=True)
|
||||||
display_order = Column(Integer, default=0, nullable=False)
|
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")
|
review = relationship("ProductReview", back_populates="images")
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,9 @@ class StorefrontService:
|
||||||
email=author_email
|
email=author_email
|
||||||
)
|
)
|
||||||
|
|
||||||
# Approved by default if no blocked words, otherwise queued for moderation
|
# All customer submitted reviews enter pending moderation (is_approved=False)
|
||||||
is_approved = not contains_blocked
|
# and require admin review before being published.
|
||||||
|
is_approved = False
|
||||||
|
|
||||||
review = ProductReview(
|
review = ProductReview(
|
||||||
review_id=str(ulid.ULID()),
|
review_id=str(ulid.ULID()),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue