Skip to content

Commit

Permalink
fix(ui): copy message (#1973)
Browse files Browse the repository at this point in the history
* fix copy message bug

* fix copy message bug

* added changelog entry
  • Loading branch information
deven98 authored Jul 3, 2024
1 parent b1bb239 commit 7efc5c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions packages/stream_chat_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Upcoming

🐞 Fixed

- Fixed copy message function.

## 7.2.2

✅ Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,12 +816,11 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
title: Text(context.translations.copyMessageLabel),
onClick: () {
Navigator.of(context, rootNavigator: true).pop();
final text = widget.message.text;
String? messageToCopy;
var messageToCopy = widget.message.text;
for (final user in widget.message.mentionedUsers.toSet()) {
final userId = user.id;
final userName = user.name;
messageToCopy = text?.replaceAll(
messageToCopy = messageToCopy?.replaceAll(
RegExp('@($userId|$userName)'),
'@$userName',
) ??
Expand Down Expand Up @@ -1040,12 +1039,11 @@ class _StreamMessageWidgetState extends State<StreamMessageWidget>
: DisplayWidget.show,
),
onCopyTap: (message) {
final text = message.text;
String? messageToCopy;
var messageToCopy = message.text;
for (final user in widget.message.mentionedUsers.toSet()) {
final userId = user.id;
final userName = user.name;
messageToCopy = text?.replaceAll(
messageToCopy = messageToCopy?.replaceAll(
RegExp('@($userId|$userName)'),
'@$userName',
) ??
Expand Down

0 comments on commit 7efc5c3

Please sign in to comment.