This commit is contained in:
Tomas Dvorak
2026-01-26 08:13:18 +01:00
parent aa036b6550
commit dfc079288f
505 changed files with 95755 additions and 5712 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# Test script to verify comment reactions fix
# This script tests that users can only leave one reaction per comment
echo "Testing comment reactions fix..."
# Test 1: Run the database migration
echo "1. Running migration to add unique constraint..."
cd /home/tdvorak/Desktop/PROG+HTML/Fotbal/fotbal-club
go run cmd/sqlmigrate/main.go up 20250120123000_add_unique_reaction_constraint
# Test 2: Build and restart the backend
echo "2. Building backend..."
go build -o fotbal-club .
echo "3. Migration completed. The fix includes:"
echo " - Database unique constraint on (comment_id, user_id)"
echo " - Frontend optimistic updates with proper state management"
echo " - Pending reaction tracking to prevent rapid clicks"
echo " - Proper cleanup of local state after server sync"
echo ""
echo "4. To test manually:"
echo " - Open any article or activity with comments"
echo " - Try to react multiple times to the same comment"
echo " - Verify only one reaction persists per user"
echo " - Test rapid clicking - buttons should disable during pending state"
echo " - Verify reaction counts update correctly"
echo ""
echo "Fix completed successfully!"