Merge pull request #1298 from GetStream/feat/hide-history

This commit is contained in:
Sahil Kumar
2022-08-08 16:12:06 +05:30
committed by GitHub
5 changed files with 21 additions and 1 deletions
+4
View File
@@ -4,6 +4,10 @@
- Fix `Channel.removeMessage` not able to remove thread message.
✅ Added
- Added `hide_history` flag in `client.addChannelMembers`, `channel.addMembers`.
## 4.4.1
🐞 Fixed
@@ -1151,9 +1151,18 @@ class Channel {
Future<AddMembersResponse> addMembers(
List<String> memberIds, [
Message? message,
// TODO: Convert to optional parameters in v5.0.0
// ignore: avoid_positional_boolean_parameters
bool hideHistory = false,
]) async {
_checkInitialized();
return _client.addChannelMembers(id!, type, memberIds, message: message);
return _client.addChannelMembers(
id!,
type,
memberIds,
message: message,
hideHistory: hideHistory,
);
}
/// Invite members to the channel.
@@ -1044,12 +1044,14 @@ class StreamChatClient {
String channelType,
List<String> memberIds, {
Message? message,
bool hideHistory = false,
}) =>
_chatApi.channel.addMembers(
channelId,
channelType,
memberIds,
message: message,
hideHistory: hideHistory,
);
/// Remove members from the channel
@@ -210,12 +210,14 @@ class ChannelApi {
String channelType,
List<String> memberIds, {
Message? message,
bool hideHistory = false,
}) async {
final response = await _client.post(
_getChannelUrl(channelId, channelType),
data: {
'add_members': memberIds,
'message': message,
'hide_history': hideHistory,
},
);
return AddMembersResponse.fromJson(response.data);
@@ -376,6 +376,7 @@ void main() {
const memberIds = ['test-member-id-1', 'test-member-id-2'];
final channelModel = ChannelModel(id: channelId, type: channelType);
final message = Message(id: 'test-message-id', text: 'members-added');
const hideHistory = true;
final path = _getChannelUrl(channelId, channelType);
@@ -384,6 +385,7 @@ void main() {
data: {
'add_members': memberIds,
'message': message,
'hide_history': hideHistory,
},
)).thenAnswer((_) async => successResponse(path, data: {
'channel': channelModel.toJson(),
@@ -395,6 +397,7 @@ void main() {
channelType,
memberIds,
message: message,
hideHistory: hideHistory,
);
expect(res, isNotNull);