Skip to content

Conversation

@LifeRIP
Copy link
Contributor

@LifeRIP LifeRIP commented Jun 24, 2025

This pull request introduces significant changes to support moderation features, enhance chat functionality, and improve API documentation. Key updates include the addition of a ModerationHandler, new API endpoints for reporting and managing chat content, and updates to the Swagger documentation to reflect these changes.

Moderation Features:

  • Added a new ModerationHandler to handle moderation-related HTTP requests, including reporting messages, retrieving banned users, and clearing user reports. (internal/handlers/moderation_handler.go, internal/handlers/moderation_handler.goR1-R207)
  • Updated main.go to include ModerationService and ModerationHandler in the dependency injection. (cmd/api/main.go, cmd/api/main.goR52-R61)

API Enhancements:

  • Added new endpoints to the Swagger documentation for moderation and chat functionality, including:
    • Reporting inappropriate messages (/chat/rooms/{roomId}/report)
    • Retrieving banned users in a room (/chat/rooms/{roomId}/banned-users)
    • Clearing user reports (/chat/rooms/{roomId}/clear-reports)
    • Fetching direct chat details (/chat/direct/{chatId})
  • Enhanced pagination support for room messages by updating the /chat/rooms/{roomId}/messages/paginated endpoint. (internal/handlers/chat_handler.go, internal/handlers/chat_handler.goL137-R137)

Data Models and Documentation:

  • Added new models to the Swagger documentation, such as models.ReportRequest, models.BannedUsersResponse, and models.ClearReportRequest, to support moderation features. (docs/swagger.yaml, [1] [2]
  • Updated existing models to include additional fields, such as displayName and reportedUsers, for better data representation. (docs/swagger.yaml, [1] [2]

Chat Functionality Improvements:

Dependency Updates:

LifeRIP added 21 commits June 10, 2025 19:20
fix(docs): Update message retrieval routes to reflect pagination changes
- Introduces a new API endpoint to fetch direct chat details by ID.
- Includes validation for user access rights to ensure authorized retrieval.
- Updates routing to register the new endpoint.
Add endpoint to retrieve direct chat details by ID
- Enhances direct chat functionality by including sender display names in responses.
- Updates service methods to fetch and attach sender names to the last message in direct chats.
- Introduces corresponding models changes to support optional display name serialization.
- Improves user experience by providing more informative chat details.
Add sender display names to direct chat messages
- Integrates Firestore client into the WebSocket hub and client logic to retrieve user display names during message processing.
- Enhances functionality by enabling dynamic user data fetching from Firestore, improving message context for chat interactions.
Integrate Firestore client for user display names in WebSocket hub
- Introduces functionality to ensure a user's existence in the database, leveraging Firebase authentication data.
- Updates `UserHandler` and related services to support this logic.
- Adds a new route `/user/ensure` for user validation and creation.
- Enhances `UserRepository` and `UserService` with methods to fetch and create users.
Add user existence validation and update endpoint documentation
- Enhances the DirectChat model by introducing `DisplayNames`, enabling retrieval of user names alongside IDs.
- Updates repository logic to populate `DisplayNames` by fetching user details from the UserRepository, improving readability and usability of direct chat data.
Add user display names to DirectChat model
- Enforces user access validation for direct chats, ensuring unauthorized users cannot access messages.
- Revises message retrieval logic for direct and room chats to return messages in descending order and subsequently reverse them for ascending order in the response.
Implement user access validation and enhance message ordering
- Introduces content moderation capabilities, including reporting inappropriate messages, banning users based on report thresholds, and clearing user reports in chat rooms.
- Adds new handlers, services, and repositories to manage these features.
- Updates WebSocket logic to prevent banned users from sending messages and modifies room models to track reported users.
- Enhances API with moderation-specific endpoints and integrates moderation checks into existing workflows.
- Introduces success confirmation messages when users join rooms or direct chats via WebSocket.
- Adds a check to prevent users from reporting the same message multiple times.
- Also updates moderation logic to enforce the maximum report threshold dynamically.
Add moderation features for user reporting and banning
refactor: Comment out success message logic in ReadPump
@LifeRIP LifeRIP merged commit 33d327d into main Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants