Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Models/Moderation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public class BanRequest

/// <summary>When true, the user will be automatically banned from all future channels created by the user who issued the ban</summary>
public bool? BanFromFutureChannels { get; set; }

/// <summary>When true, all reactions by the banned user on other users' messages will be deleted</summary>
public bool? DeleteReactions { get; set; }
}

public class ShadowBanRequest : BanRequest
Expand Down
16 changes: 16 additions & 0 deletions tests/UserClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,22 @@ await _userClient.BanAsync(new BanRequest
await sendMessageCall.Should().ThrowAsync<StreamChatException>();
}

[Test]
public async Task TestBanUserWithDeleteReactionsAsync()
{
// Reaction deletion happens asynchronously, so we only verify the API accepts the parameter
Func<Task> banCall = () => _userClient.BanAsync(new BanRequest
{
Type = _channel.Type,
Id = _channel.Id,
Reason = "reason",
TargetUserId = _user2.Id,
UserId = _user1.Id,
DeleteReactions = true,
});
await banCall.Should().NotThrowAsync();
}

[Test]
public async Task TestUnbanUserAsync()
{
Expand Down
Loading