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
Return if receive own message #10618
Return if receive own message #10618
Conversation
|
Thanks for the PR and congrats on your first contribution to our codebase @DRBragg! 🎉 |
|
Thanks @citizen428. I was a little confused when you said "first contribution" but then I realized all my previous contributions have been helping others contribute 😅 |
| @@ -174,8 +175,7 @@ class UnopenedChannelNotice extends Component { | |||
| <div> | |||
| {channel.request_type === 'mentioned' | |||
| ? 'You got mentioned in' | |||
| : 'New Message from'} | |||
| {' '} | |||
| : 'New Message from'}{' '} | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier in action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Thank you for your PR @DRBragg. 👏🏻
What type of PR is this? (check all applicable)
Description
If you have dev.to open in multiple tabs and you send a message in a chat channel you will get an unread notification in the other tabs for your own message. This PR fixes that by simply exiting from the
receiveNewMessagecallback early if the message received is your own (same user id).Possible related refactoring: the
receiveNewMessagefunction already had a few checks that I think were supposed to solve this exact issue but didn't. We may be able to adjust or remove them completely but I would want someone who is more familiar with this feature (preact & pusher) to look at it first and make sure I'm not messing something else up.Basically the function returns if the user: is already in the chat area ('/connect') AND is the same user that sent the message AND the message is for a non-direct channel. I don't see any reason why we wouldn't just return if the user is the same user that sent the message.
Related Tickets & Documents
Fixes issue #10606
Added tests?
There aren't any tests for this particular utility yet and I don't fell confident enough to start a test suite from scratch.
Added to documentation?