Skip to content

Extend some user-related models and implement private messaging #12

@uxabix

Description

@uxabix

We need to extend the messaging system to support private 1-on-1 chats and implement the ability to block users, while maintaining compatibility with existing lobby and general chat functionality.


Requirements

Model Extensions

  • Create a new Chat model to handle different types of chats:
    • Private 1-on-1 chats
    • Lobby-linked chats
    • General/global chats
  • Refactor or update the existing Message model to reference the new Chat model.
  • Implement a mechanism to block users, preventing messages from blocked users from being delivered. Possible approaches:
    • Introduce a BlockedUser model linking two users.
    • Add a blocked_users ManyToMany field on the User model.
    • Enforce block logic in message sending at the model or API layer.
  • Ensure backward compatibility with existing chat types (lobby/general).

Private Messaging

  • Implement 1-on-1 private messaging between users.
  • Messages must be stored in the database and retrievable via API.
  • [] Ensure blocked users cannot send messages to the blocker.
  • Optional: prepare for future group chat implementation, but focus on 1-on-1 messaging first.

Technical Details

  • Use Django models and REST API for message storage and retrieval.
  • The Chat model should track participants and chat type.
  • Ensure database integrity: avoid duplicate chat instances for the same user pair.
  • Implement blocking logic at the model or API level.
  • Maintain compatibility with current lobby/general chat features.

Testing

  • Verify private messages can be sent and received correctly.
  • Confirm blocked users cannot send messages to the blocker.
  • Ensure lobby and general chat functionality is unaffected.
  • Test edge cases like sending messages to oneself or attempting to message a blocked user.
  • Verify database consistency for Chat and Message models.

Definition of Done

  • Chat model created and integrated with messages.
  • [ x Private 1-on-1 messaging implemented and functional.
  • User blocking functionality enforced in messaging.
  • Existing lobby/general chat system remains compatible.
  • API endpoints allow sending and retrieving private messages.
  • Tests confirm correct behavior for messaging and blocking.
  • Documentation updated with model changes and API usage.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions