Skip to content
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

Implemented a system message in a stream chat when it's mentioned in another stream chat, with validation and cleanup #2770

Closed
wants to merge 1 commit into from

Conversation

matanfield
Copy link
Member

What was changed?

Stream Mention System Implementation

Overview

Added functionality to create system messages when a stream is mentioned in another stream's chat. When a user mentions stream X in stream Y, a system message appears in stream X saying "This stream was mentioned in _streamYName by _userName" with clickable links to both the source stream and the user.

Key Changes

  • Added new system message type for stream mentions
  • Implemented stream mention detection and validation
  • Added system message creation with proper error handling
  • Added cleanup mechanism for failed message sends
  • Added comprehensive test coverage

Implementation Details

  • Stream mentions use the format: [stream]streamId|streamName[/stream]
  • System messages include clickable links to:
    • Source stream where mention occurred
    • User who mentioned the stream
  • Added validation to ensure mentioned streams exist
  • Implemented optimistic updates with proper cleanup on failure

Testing

Automated Tests

  • Added test suite covering:
    • Stream mention detection
    • System message rendering
    • Error handling
    • Integration tests

Manual Testing Steps

  1. Create a message mentioning a stream using: [stream]streamId|streamName[/stream]
  2. Verify system message appears in mentioned stream
  3. Verify both links (stream and user) are clickable and navigate correctly
  4. Test error cases:
    • Mentioning non-existent streams
    • Network issues
    • Multiple mentions in one message

Safety Measures

  • Stream ID validation before system message creation
  • Cleanup mechanism for failed message sends
  • Comprehensive error handling
  • Proper logging for debugging

Dependencies

No new dependencies added.

Notes

  • Rate limiting for stream mentions can be added in future iterations if needed
  • Maximum mentions per message can be implemented if abuse is detected

Copy link

netlify bot commented Nov 28, 2024

Deploy Preview for preview-common failed.

Name Link
🔨 Latest commit 2a33321
🔍 Latest deploy log https://app.netlify.com/sites/preview-common/deploys/6748b4988218850008fff2d1

@matanfield matanfield closed this Nov 28, 2024
@matanfield matanfield deleted the system-message-stream-mentioned branch November 28, 2024 19:32
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.

1 participant