Fix review system: display real names and check approval status
Changes: - ProductReviews.tsx: Use LEFT JOIN and fetch reviewer_name field - ReviewModal.tsx: Store reviewer_name at submission time - ProductDetail.tsx: Check is_approved=true in checkUserReview() - Add migration for reviewer_name column and approval index This fixes two issues: 1. Reviews now show real account names instead of "Anonymous" 2. Members no longer see "menunggu moderasi" after approval 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,14 +162,15 @@ export default function ProductDetail() {
|
||||
|
||||
const checkUserReview = async () => {
|
||||
if (!product || !user) return;
|
||||
|
||||
|
||||
const { data } = await supabase
|
||||
.from('reviews')
|
||||
.select('id')
|
||||
.eq('user_id', user.id)
|
||||
.eq('product_id', product.id)
|
||||
.eq('is_approved', true)
|
||||
.limit(1);
|
||||
|
||||
|
||||
setHasReviewed(!!(data && data.length > 0));
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user