Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Mention of a user renders as a shorter mentioned name followed by leftover text

Đang mở Phù hợp với người mới
#3,096 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
dart, flutter
Lĩnh vực
frontend

Hướng nghiên cứu

Bắt đầu bằng cách tìm MessageX.replaceMentions, được nêu trong issue, và theo dõi cách hàm này khớp từng người dùng trong mentionedUsers. Dùng đoạn mã Dart được cung cấp để tái hiện trường hợp với Ann và Anna, rồi kiểm tra văn bản nhắc tên được tạo ra và đích khi nhấn. Hoàn tất khi tên dài hơn hiển thị là @Anna và liên kết đến anna trong nội dung tin nhắn, bản xem trước và câu trả lời trích dẫn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Which packages are you using?

stream_chat_flutter

On what platforms did you experience the issue?

iOS, Android, Web, macOS, Windows, Linux (platform independent)

What version are you using?

10.6.0 (current master)

What happened?

When a message mentions two users and one user's name (or id) is a prefix of the other's, the longer mention renders as the shorter one followed by the leftover characters. Tapping it opens the wrong user.

For example, with Ann and Anna both mentioned in Hi @Ann and @Anna!, MessageX.replaceMentions returns:

Hi [@Ann](mention:ann) and [@Ann](mention:ann)a!

The message shows @Ann highlighted followed by a plain a, and the second mention points to ann instead of anna. The same happens with ids such as user1 and user12, and in the channel list preview and quoted replies (replaceMentions(linkify: false) turns @user12 into @First2).

replaceMentions replaces one mention source at a time with @<literal>, so whichever user comes first in mentionedUsers also matches the start of every longer literal that shares its prefix.

Steps to reproduce
final message = Message(
  text: 'Hi @Ann and @Anna!',
  mentionedUsers: [
    User(id: 'ann', name: 'Ann'),
    User(id: 'anna', name: 'Anna'),
  ],
);

print(message.replaceMentions().text);
// Hi [@Ann](mention:ann) and [@Ann](mention:ann)a!

In the app: in a channel with members Ann and Anna, mention Ann first, then Anna, and send the message.

Expected behavior
Hi [@Ann](mention:ann) and [@Anna](mention:anna)!
Ngôn ngữ chính
Dart
Star
1.1k
Fork
388
Merge trung bình
3 ngày 7 giờ
Pull request đã merge (30 ngày)
74

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của GetStream/stream-chat-flutter

Tất cả issue của GetStream/stream-chat-flutter

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.