SebastienBtr/Dash-Chat-2

[Bug] Mention bug

Closed this issue · 5 comments

If i double mention a user for example:
Hello @Niki @Niki, you should check #channel
It will cause Bad state no element on default_message_text line 70

Hello, are you sure you added all the mentions in the message.mentions list? Could you please provide a complete, minimal example that reproduces this issue?

@SebastienBtr I'm using example app MentionSample
Change text from Hello @Niki, you should check #channel to Hello @Niki @Niki, you should check #channel

List<ChatMessage> mentionSample = <ChatMessage>[
  ChatMessage(
    text: 'Hello @Niki @Niki, you should check #channel',
    user: user2,
    createdAt: DateTime(2021, 01, 31, 16, 45),
    mentions: [
      Mention(title: '@Niki', customProperties: {'userId': user5.id}),
      Mention(title: '#channel'),
    ],
  ),
];

Ok then it's what I said, you are not adding all the mentions in the list. You need to add a mention in the list for each mention of your message:

List<ChatMessage> mentionSample = <ChatMessage>[
  ChatMessage(
    text: 'Hello @Niki @Niki, you should check #channel',
    user: user2,
    createdAt: DateTime(2021, 01, 31, 16, 45),
    mentions: [
      Mention(title: '@Niki', customProperties: {'userId': user5.id}),
      Mention(title: '@Niki', customProperties: {'userId': user5.id}), // Can potentially be another user id and/or have other customProperties because multiple users can have the same name
      Mention(title: '#channel'),
    ],
  ),
];

I understand the confusion, feel free to open a PR to improve the documentation if you feel it's needed

Closing this issue, feel free to reach out if you have more questions. Thanks for your quick response!

@SebastienBtr If i just type in instead of picking a user to mention like this example video

fixed in 0.0.20