docs: update documentation with chat enhancements

Document three recent chat improvements:

1. Real-time Active Users Fix (dd31761)
   - Fixed bug where users list didn't update when new users joined
   - Rewrote getAllDisplayUsers() to prioritize Socket.IO data

2. Message Length Limits (4a91a10)
   - Added 2000 character limit with visual counter
   - Backend + frontend validation

3. Spam Protection System (ace3311)
   - Rate limiting: 10 messages per minute
   - Duplicate detection within 60 second window
   - Profanity filter with Polish + English words

Updated:
- README.md: Added chat features to Events & Chat section
- SESSION_CONTEXT.md: New "Chat Enhancements" section
- COMPLETED.md: Comprehensive entry with problem/solution/impact
- Last updated dates: 2025-12-03
This commit is contained in:
Radosław Gierwiało
2025-12-03 00:03:37 +01:00
parent ace33111a4
commit f6fd983c68
3 changed files with 187 additions and 6 deletions

View File

@@ -22,6 +22,9 @@
### Core Features (All Implemented)
- JWT authentication with email verification (AWS SES)
- Real-time chat (Socket.IO) - event rooms + private 1:1
- Real-time active users with instant updates
- Message validation (2000 char limit with visual counter)
- Spam protection (rate limiting, duplicate detection, profanity filter)
- WebRTC P2P file transfer (RTCDataChannel, up to 700MB tested)
- Competition heats system for matchmaking
- Recording matching system with 3-tier account system (BASIC/SUPPORTER/COMFORT)
@@ -98,9 +101,37 @@ Key models:
---
## Recent Changes (2025-12-02)
## Recent Changes (2025-12-03)
### Activity Log System (Phase 3.5) - Complete ✅
### Chat Enhancements - Complete ✅
**Real-time updates, message validation, and spam protection**
**Commits:** `dd31761` (real-time users), `4a91a10` (message limits), `ace3311` (spam protection)
**1. Real-time Active Users Fix (dd31761)**
- Fixed bug where active users list didn't update when new users joined chat
- Root cause: Used static `checkedInUsers` as base instead of real-time `activeUsers`
- Solution: Rewrote `getAllDisplayUsers()` to prioritize Socket.IO data
- Files: `frontend/src/pages/EventChatPage.jsx`, `frontend/src/hooks/useEventChat.js`
**2. Message Length Limits (4a91a10)**
- Added 2000 character limit for all chat messages (event + match chat)
- Backend validation in `send_event_message` and `send_match_message` handlers
- Frontend: `maxLength` attribute + character counter at 80% threshold (1600+)
- Visual feedback: red text when at limit, submit button disabled
- Files: `backend/src/constants/index.js`, `backend/src/socket/index.js`, `frontend/src/constants/index.js`, `frontend/src/components/chat/ChatInput.jsx`
**3. Spam Protection System (ace3311)**
- Rate Limiting: 10 messages per minute per user
- Duplicate Detection: Prevents identical messages within 1 minute window
- Profanity Filter: bad-words library (v2.0.0) with English + 11 Polish words
- In-memory tracking with automatic cleanup every 5 minutes
- User-friendly error messages for each validation type
- Files: `backend/src/middleware/messageValidation.js` (new), `backend/src/socket/index.js`, `backend/package.json`
---
### Activity Log System (Phase 3.5) - Complete ✅ (2025-12-02)
**Comprehensive admin monitoring with real-time streaming dashboard**
**Backend (Phases 1-5):**
@@ -229,4 +260,4 @@ REST_BUFFER_MINUTES: 60
---
**Last Updated:** 2025-12-02
**Last Updated:** 2025-12-03