Skip to content

Commit 736a7be

Browse files
committed
chore: merge fixes
1 parent 341973d commit 736a7be

File tree

10 files changed

+265
-159
lines changed

10 files changed

+265
-159
lines changed

packages/stream_chat/lib/src/client/channel.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3142,13 +3142,12 @@ class ChannelClientState {
31423142
// a thread-only message.
31433143
if (isUpToDate || isThreadOnlyMessage) updateMessage(message);
31443144

3145-
// Otherwise, check if we can count the message as unread.
3146-
if (MessageRules.canCountAsUnread(message, _channel)) {
3147-
unreadCount += 1; // Increment unread count
3148-
}
3145+
// Otherwise, check if we can count the message as unread.
3146+
if (MessageRules.canCountAsUnread(message, _channel)) {
3147+
unreadCount += 1; // Increment unread count
3148+
}
31493149

3150-
_client.channelDeliveryReporter.submitForDelivery([_channel]);
3151-
}));
3150+
_client.channelDeliveryReporter.submitForDelivery([_channel]);
31523151
}
31533152

31543153
/// Updates the [read] in the state if it exists. Adds it otherwise.
@@ -3870,7 +3869,7 @@ class ChannelClientState {
38703869
// Calculate the new last message at time.
38713870
var lastMessageAt = _channelState.channel?.lastMessageAt;
38723871
for (final message in affectedMessages) {
3873-
if (_shouldUpdateChannelLastMessageAt(message)) {
3872+
if (MessageRules.canUpdateChannelLastMessageAt(message, _channel)) {
38743873
lastMessageAt = [lastMessageAt, message.createdAt].nonNulls.max;
38753874
}
38763875
}

packages/stream_chat/lib/src/core/models/channel_config.g.dart

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/stream_chat/lib/src/core/util/message_rules.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ class MessageRules {
1919
/// * A poll
2020
static bool canUpload(Message message) {
2121
final hasText = message.text?.trim().isNotEmpty == true;
22+
if (hasText) return true;
23+
2224
final hasAttachments = message.attachments.isNotEmpty;
25+
if (hasAttachments) return true;
26+
2327
final hasQuotedMessage = message.quotedMessageId != null;
28+
if (hasQuotedMessage) return true;
29+
30+
final hasSharedLocation = message.sharedLocation != null;
31+
if (hasSharedLocation) return true;
32+
2433
final hasPoll = message.pollId != null;
34+
if (hasPoll) return true;
2535

26-
return hasText || hasAttachments || hasQuotedMessage || hasPoll;
36+
return false;
2737
}
2838

2939
/// Whether the [message] can update the channel's last message timestamp.

packages/stream_chat/lib/stream_chat.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export 'src/core/models/location.dart';
4848
export 'src/core/models/location_coordinates.dart';
4949
export 'src/core/models/member.dart';
5050
export 'src/core/models/message.dart';
51-
export 'src/core/models/message_delivery.dart';
5251
export 'src/core/models/message_delete_scope.dart';
52+
export 'src/core/models/message_delivery.dart';
5353
export 'src/core/models/message_reminder.dart';
5454
export 'src/core/models/message_state.dart';
5555
export 'src/core/models/moderation.dart';

0 commit comments

Comments
 (0)