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

fix: trimmed mentioned user text in messages when special characters used #1909

Merged
merged 5 commits into from
Jan 13, 2023

Conversation

khushal87
Copy link
Member

@khushal87 khushal87 commented Jan 13, 2023

🎯 Goal

When users with special characters such as - or _ are mentioned in the message and sent. The mentioned user is trimmed in the message bubble. This can be tested by mentioning users like divine-flower-3, dummy_tummy etc., in our channel - Determined Detail(Channel Cid - channel-ex-example-apps-23) in our TypescriptMessagingApp.

Ref Zendesk Ticket - https://getstream.zendesk.com/agent/tickets/33250

🛠 Implementation details

The node of such a user as parsed by simple-markdown is:

  • User id - dummy_tummy
{"content": [{"content": "@dummy", "type": "text"}, {"content": "_tummy", "type": "text"}], "type": "mentions"}
  • User id - divine-flower-3
{"content": [{"content": "@divine", "type": "text"}, {"content": "-flower", "type": "text"}, {"content": "-3", "type": "text"}], "type": "mentions"}

Previously only the node.content[0].content was rendered, which is why the text was trimmed; now, the entire name is joined/concatenated using the reduce function and displayed. Therefore it works.

🎨 UI Changes

Before After
Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-01-13.at.11.52.19.mp4
Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-01-13.at.11.53.46.mp4

🧪 Testing

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch
  • Documentation is updated
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@sonarcloud
Copy link

sonarcloud bot commented Jan 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@khushal87 khushal87 merged commit e64b1d6 into develop Jan 13, 2023
@khushal87 khushal87 deleted the khushal87/fix-mentioned-user-text branch January 13, 2023 12:44
@github-actions github-actions bot mentioned this pull request Jan 13, 2023
@vishalnarkhede
Copy link
Contributor

🎉 This PR is included in version 5.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

None yet

3 participants