-
Notifications
You must be signed in to change notification settings - Fork 0
Add ModerationHandler and API Endpoints for Improved Chat Management #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
ModerationHandlerto 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)main.goto includeModerationServiceandModerationHandlerin the dependency injection. (cmd/api/main.go, cmd/api/main.goR52-R61)API Enhancements:
/chat/rooms/{roomId}/report)/chat/rooms/{roomId}/banned-users)/chat/rooms/{roomId}/clear-reports)/chat/direct/{chatId})/chat/rooms/{roomId}/messages/paginatedendpoint. (internal/handlers/chat_handler.go, internal/handlers/chat_handler.goL137-R137)Data Models and Documentation:
models.ReportRequest,models.BannedUsersResponse, andmodels.ClearReportRequest, to support moderation features. (docs/swagger.yaml, [1] [2]displayNameandreportedUsers, for better data representation. (docs/swagger.yaml, [1] [2]Chat Functionality Improvements:
GetDirectChatWithSenderName, to retrieve direct chat details with sender names. (internal/handlers/chat_handler.go, internal/handlers/chat_handler.goR393-R439)GetUserDirectChatsto include sender names in the response. (internal/handlers/chat_handler.go, internal/handlers/chat_handler.goL227-R227)Dependency Updates:
NewUserHandlerto acceptAuthServiceas a dependency for improved user-related operations. (internal/handlers/user_handler.go, internal/handlers/user_handler.goR13-R20)