Merge remote-tracking branch 'origin/develop' into v4
# Conflicts: # packages/stream_chat/CHANGELOG.md # packages/stream_chat/lib/src/client/channel.dart # packages/stream_chat_flutter/CHANGELOG.md
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"user": {
|
||||
"id": "super-band-9",
|
||||
"role": "user",
|
||||
"created_at": "2020-03-03T16:48:28.853674Z",
|
||||
"updated_at": "2021-05-26T03:22:20.296181Z",
|
||||
"last_active": "2021-06-16T11:42:29.466165498Z",
|
||||
"banned": false,
|
||||
"online": true,
|
||||
"username": "Rioland",
|
||||
"image": "https://placehold.jp/150x150.png",
|
||||
"invisible": false,
|
||||
"name": "Proud darkness",
|
||||
"unread_count": 0
|
||||
},
|
||||
"channel": {
|
||||
"id": "!members-Qsp7PpigdPkW0rJk0603y5GnTiF1iRfoDc4SAngMMmw",
|
||||
"type": "messaging",
|
||||
"cid": "messaging:!members-Qsp7PpigdPkW0rJk0603y5GnTiF1iRfoDc4SAngMMmw",
|
||||
"last_message_at": "2020-12-02T06:56:18.003432Z",
|
||||
"created_at": "2020-11-30T10:25:32.494601Z",
|
||||
"updated_at": "2020-11-30T10:25:32.494601Z",
|
||||
"created_by": {
|
||||
"id": "super-band-9",
|
||||
"role": "user",
|
||||
"created_at": "2020-03-03T16:48:28.853674Z",
|
||||
"updated_at": "2021-05-26T03:22:20.296181Z",
|
||||
"last_active": "2021-06-16T11:42:29.466165498Z",
|
||||
"banned": false,
|
||||
"online": true,
|
||||
"image": "https://placehold.jp/150x150.png",
|
||||
"invisible": false,
|
||||
"name": "Proud darkness",
|
||||
"unread_count": 0,
|
||||
"username": "Rioland"
|
||||
},
|
||||
"frozen": false,
|
||||
"disabled": false,
|
||||
"member_count": 2,
|
||||
"config": {
|
||||
"created_at": "2020-04-15T14:57:17.00966Z",
|
||||
"updated_at": "2021-05-25T14:25:30.405621Z",
|
||||
"name": "messaging",
|
||||
"typing_events": true,
|
||||
"read_events": true,
|
||||
"connect_events": true,
|
||||
"search": true,
|
||||
"reactions": true,
|
||||
"replies": true,
|
||||
"mutes": true,
|
||||
"uploads": true,
|
||||
"url_enrichment": true,
|
||||
"custom_events": false,
|
||||
"push_notifications": true,
|
||||
"message_retention": "infinite",
|
||||
"max_message_length": 5000,
|
||||
"automod": "disabled",
|
||||
"automod_behavior": "flag",
|
||||
"blocklist": "profanity_en_2020_v1",
|
||||
"blocklist_behavior": "block",
|
||||
"automod_thresholds": {},
|
||||
"commands": [
|
||||
{
|
||||
"name": "giphy",
|
||||
"description": "Post a random gif to the channel",
|
||||
"args": "[text]",
|
||||
"set": "fun_set"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"created_at": "2020-12-04T10:39:06.512021Z",
|
||||
"updated_at": "2020-12-04T10:39:06.512021Z"
|
||||
}
|
||||
+13
-55
@@ -13,61 +13,19 @@
|
||||
"name": "Proud darkness",
|
||||
"unread_count": 0
|
||||
},
|
||||
"channel": {
|
||||
"id": "!members-Qsp7PpigdPkW0rJk0603y5GnTiF1iRfoDc4SAngMMmw",
|
||||
"type": "messaging",
|
||||
"cid": "messaging:!members-Qsp7PpigdPkW0rJk0603y5GnTiF1iRfoDc4SAngMMmw",
|
||||
"last_message_at": "2020-12-02T06:56:18.003432Z",
|
||||
"created_at": "2020-11-30T10:25:32.494601Z",
|
||||
"updated_at": "2020-11-30T10:25:32.494601Z",
|
||||
"created_by": {
|
||||
"id": "super-band-9",
|
||||
"role": "user",
|
||||
"created_at": "2020-03-03T16:48:28.853674Z",
|
||||
"updated_at": "2021-05-26T03:22:20.296181Z",
|
||||
"last_active": "2021-06-16T11:42:29.466165498Z",
|
||||
"banned": false,
|
||||
"online": true,
|
||||
"image": "https://placehold.jp/150x150.png",
|
||||
"invisible": false,
|
||||
"name": "Proud darkness",
|
||||
"unread_count": 0,
|
||||
"username": "Rioland"
|
||||
},
|
||||
"frozen": false,
|
||||
"disabled": false,
|
||||
"member_count": 2,
|
||||
"config": {
|
||||
"created_at": "2020-04-15T14:57:17.00966Z",
|
||||
"updated_at": "2021-05-25T14:25:30.405621Z",
|
||||
"name": "messaging",
|
||||
"typing_events": true,
|
||||
"read_events": true,
|
||||
"connect_events": true,
|
||||
"search": true,
|
||||
"reactions": true,
|
||||
"replies": true,
|
||||
"mutes": true,
|
||||
"uploads": true,
|
||||
"url_enrichment": true,
|
||||
"custom_events": false,
|
||||
"push_notifications": true,
|
||||
"message_retention": "infinite",
|
||||
"max_message_length": 5000,
|
||||
"automod": "disabled",
|
||||
"automod_behavior": "flag",
|
||||
"blocklist": "profanity_en_2020_v1",
|
||||
"blocklist_behavior": "block",
|
||||
"automod_thresholds": {},
|
||||
"commands": [
|
||||
{
|
||||
"name": "giphy",
|
||||
"description": "Post a random gif to the channel",
|
||||
"args": "[text]",
|
||||
"set": "fun_set"
|
||||
}
|
||||
]
|
||||
}
|
||||
"target": {
|
||||
"id": "super-band-10",
|
||||
"role": "user",
|
||||
"created_at": "2020-03-03T16:48:28.853674Z",
|
||||
"updated_at": "2021-05-26T03:22:20.296181Z",
|
||||
"last_active": "2021-06-16T11:42:29.466165498Z",
|
||||
"banned": false,
|
||||
"online": true,
|
||||
"username": "Holland",
|
||||
"image": "https://placehold.jp/150x150.png",
|
||||
"invisible": false,
|
||||
"name": "Proud brightness",
|
||||
"unread_count": 0
|
||||
},
|
||||
"created_at": "2020-12-04T10:39:06.512021Z",
|
||||
"updated_at": "2020-12-04T10:39:06.512021Z"
|
||||
|
||||
@@ -645,8 +645,8 @@ void main() {
|
||||
|
||||
when(() => persistence.getChannelThreads(any()))
|
||||
.thenAnswer((_) async => {});
|
||||
when(() => persistence.updateMessages(any(), any()))
|
||||
.thenAnswer((_) => Future.value());
|
||||
when(() => persistence.updateChannelThreads(any(), any()))
|
||||
.thenAnswer((_) async => {});
|
||||
when(() => persistence.getChannelStateByCid(any(),
|
||||
messagePagination: any(named: 'messagePagination'),
|
||||
pinnedMessagePagination:
|
||||
@@ -692,7 +692,7 @@ void main() {
|
||||
|
||||
verify(() => persistence.getChannelThreads(any()))
|
||||
.called((persistentChannelStates + channelStates).length);
|
||||
verify(() => persistence.updateMessages(any(), any()))
|
||||
verify(() => persistence.updateChannelThreads(any(), any()))
|
||||
.called((persistentChannelStates + channelStates).length);
|
||||
verify(
|
||||
() => persistence.getChannelStateByCid(any(),
|
||||
@@ -733,8 +733,8 @@ void main() {
|
||||
|
||||
when(() => persistence.getChannelThreads(any()))
|
||||
.thenAnswer((_) async => {});
|
||||
when(() => persistence.updateMessages(any(), any()))
|
||||
.thenAnswer((_) => Future.value());
|
||||
when(() => persistence.updateChannelThreads(any(), any()))
|
||||
.thenAnswer((_) async => {});
|
||||
when(() => persistence.getChannelStateByCid(any(),
|
||||
messagePagination: any(named: 'messagePagination'),
|
||||
pinnedMessagePagination:
|
||||
@@ -775,7 +775,7 @@ void main() {
|
||||
|
||||
verify(() => persistence.getChannelThreads(any()))
|
||||
.called(persistentChannelStates.length);
|
||||
verify(() => persistence.updateMessages(any(), any()))
|
||||
verify(() => persistence.updateChannelThreads(any(), any()))
|
||||
.called(persistentChannelStates.length);
|
||||
verify(
|
||||
() => persistence.getChannelStateByCid(any(),
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:stream_chat/src/core/models/channel_model.dart';
|
||||
import 'package:stream_chat/src/core/models/channel_mute.dart';
|
||||
import 'package:stream_chat/src/core/models/user.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../utils.dart';
|
||||
|
||||
void main() {
|
||||
group('src/models/channel_mute', () {
|
||||
test('should parse json correctly', () {
|
||||
final mute = ChannelMute.fromJson(jsonFixture('channel_mute.json'));
|
||||
expect(mute.user, isA<User>());
|
||||
expect(mute.channel, isA<ChannelModel>());
|
||||
expect(mute.createdAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
|
||||
expect(mute.updatedAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:stream_chat/src/core/models/channel_model.dart';
|
||||
import 'package:stream_chat/src/core/models/mute.dart';
|
||||
import 'package:stream_chat/src/core/models/user.dart';
|
||||
import 'package:test/test.dart';
|
||||
@@ -6,12 +5,13 @@ import 'package:test/test.dart';
|
||||
import '../../utils.dart';
|
||||
|
||||
void main() {
|
||||
group('src/models/mute', () {
|
||||
group('src/models/channel_mute', () {
|
||||
test('should parse json correctly', () {
|
||||
final mute = Mute.fromJson(jsonFixture('mute.json'));
|
||||
expect(mute.channel, isA<ChannelModel>());
|
||||
expect(mute.user, isA<User>());
|
||||
expect(mute.target, isA<User>());
|
||||
expect(mute.createdAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
|
||||
expect(mute.updatedAt, DateTime.parse('2020-12-04T10:39:06.512021Z'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:stream_chat/src/core/models/channel_mute.dart';
|
||||
import 'package:stream_chat/stream_chat.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
@@ -6,12 +7,14 @@ import '../../utils.dart';
|
||||
|
||||
class MockMute extends Mock implements Mute {}
|
||||
|
||||
class ChannelMockMute extends Mock implements ChannelMute {}
|
||||
|
||||
class MockDevice extends Mock implements Device {}
|
||||
|
||||
void main() {
|
||||
final devices = [MockDevice(), MockDevice()];
|
||||
final mutes = [MockMute(), MockMute()];
|
||||
final channelMutes = [MockMute()];
|
||||
final channelMutes = [ChannelMockMute()];
|
||||
final createdAt = DateTime.parse('2021-05-03 12:39:21.817646');
|
||||
final updatedAt = DateTime.parse('2021-04-03 12:39:21.817646');
|
||||
final lastActive = DateTime.parse('2021-03-03 12:39:21.817646');
|
||||
|
||||
@@ -162,6 +162,23 @@ void main() {
|
||||
expect(channelState, isNotNull);
|
||||
});
|
||||
|
||||
test('updateChannelThreads', () async {
|
||||
const cid = 'test:cid';
|
||||
final user = User(id: 'test-user-id');
|
||||
final threads = {
|
||||
'parent-test-message': [
|
||||
Message(
|
||||
id: 'test-message',
|
||||
text: 'test-message',
|
||||
user: user,
|
||||
ownReactions: [Reaction(type: 'test', user: user)],
|
||||
latestReactions: [Reaction(type: 'test', user: user)],
|
||||
)
|
||||
]
|
||||
};
|
||||
persistenceClient.updateChannelThreads(cid, threads);
|
||||
});
|
||||
|
||||
test('updateChannelState', () async {
|
||||
final channelState = ChannelState();
|
||||
persistenceClient.updateChannelState(channelState);
|
||||
|
||||
Reference in New Issue
Block a user