feat: Added new docs
This commit is contained in:
@@ -4,3 +4,59 @@ sidebar_position: 12
|
||||
title: Muting Channels
|
||||
---
|
||||
|
||||
Messages added to a channel will not trigger push notifications, nor change the unread count for the users that muted it.
|
||||
|
||||
By default, mutes stay in place indefinitely until the user removes it; however, you can optionally set an expiration time.
|
||||
|
||||
The list of muted channels and their expiration time is returned when the user connects.
|
||||
|
||||
### Channel Mute
|
||||
|
||||
```dart
|
||||
// mute channel for current user
|
||||
await channel.mute();
|
||||
|
||||
// mute a channel for 2 weeks
|
||||
await channel.mute(expiration: Duration(days: 15));
|
||||
|
||||
// mute a channel for 10 seconds
|
||||
await channel.mute(expiration: Duration(seconds: 10));
|
||||
|
||||
// check if channel is muted
|
||||
channel.isMuted;
|
||||
```
|
||||
|
||||
### Query Muted Channels
|
||||
|
||||
Muted channels can be filtered or excluded by using the `muted` in your query channels filter.
|
||||
|
||||
```dart
|
||||
// retrieve all channels excluding muted ones
|
||||
await client.queryChannels(
|
||||
filter: {
|
||||
'members': {
|
||||
r'$in': [userId],
|
||||
},
|
||||
'muted': false,
|
||||
}
|
||||
);
|
||||
|
||||
// retrieve all muted channels
|
||||
await client.queryChannels(
|
||||
filter: {
|
||||
'muted': true,
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
### Remove a Channel Mute
|
||||
|
||||
Whenever you need to unmute, you are able to.
|
||||
|
||||
```dart
|
||||
// unmute channel for current user
|
||||
await channel.unmute();
|
||||
|
||||
// unmute channel for a user (server-side)
|
||||
await channel.unmute({ user_id: userId });
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user