Merge pull request #180 from GetStream/shadowBan

Shadow ban
This commit is contained in:
Salvatore Giordano
2020-12-23 12:47:29 +01:00
committed by GitHub
6 changed files with 14 additions and 3 deletions
+4
View File
@@ -1,3 +1,7 @@
## 0.2.20
- Implement shadowban
## 0.2.19 ## 0.2.19
- Updated llc dependency - Updated llc dependency
+1 -1
View File
@@ -128,7 +128,7 @@ class ChannelPreview extends StatelessWidget {
stream: channel.state.messagesStream, stream: channel.state.messagesStream,
initialData: channel.state.messages, initialData: channel.state.messages,
builder: (context, snapshot) { builder: (context, snapshot) {
final lastMessage = channel.state.lastMessage; final lastMessage = snapshot.data?.lastWhere((m) => m.shadowed != true);
if (lastMessage == null) { if (lastMessage == null) {
return SizedBox(); return SizedBox();
} }
+2 -1
View File
@@ -522,7 +522,8 @@ class _MessageListViewState extends State<MessageListView> {
.map((messages) => .map((messages) =>
messages messages
?.where((m) => ?.where((m) =>
!(m.status == MessageSendingStatus.FAILED && m.isDeleted)) !(m.status == MessageSendingStatus.FAILED && m.isDeleted) &&
m.shadowed != true)
?.toList() ?? ?.toList() ??
[]) [])
.listen((newMessages) { .listen((newMessages) {
+1
View File
@@ -184,6 +184,7 @@ class StreamChatState extends State<StreamChat> with WidgetsBindingObserver {
.on(EventType.messageNew) .on(EventType.messageNew)
.where((e) => e.user?.id != user.id) .where((e) => e.user?.id != user.id)
.where((e) => e.message.silent != true) .where((e) => e.message.silent != true)
.where((e) => e.message.shadowed != true)
.listen((event) async { .listen((event) async {
final channel = client.channel( final channel = client.channel(
event.channelType, event.channelType,
+1 -1
View File
@@ -1,7 +1,7 @@
name: stream_chat_flutter name: stream_chat_flutter
homepage: https://github.com/GetStream/stream-chat-flutter homepage: https://github.com/GetStream/stream-chat-flutter
description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter. description: Stream Chat official Flutter SDK. Build your own chat experience using Dart and Flutter.
version: 0.2.19 version: 0.2.20
repository: https://github.com/GetStream/stream-chat-flutter repository: https://github.com/GetStream/stream-chat-flutter
issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues issue_tracker: https://github.com/GetStream/stream-chat-flutter/issues
+5
View File
@@ -24,6 +24,11 @@ void main() {
'name': 'test name', 'name': 'test name',
}); });
when(channelState.unreadCount).thenReturn(1); when(channelState.unreadCount).thenReturn(1);
when(channelState.messages).thenReturn([
Message(
text: 'hello',
)
]);
when(channelState.lastMessage).thenReturn(Message( when(channelState.lastMessage).thenReturn(Message(
text: 'hello', text: 'hello',
)); ));