From e163bc7a9d5e0ec5813ed9f27fedd7d9a05ccfc7 Mon Sep 17 00:00:00 2001 From: Varsh Date: Mon, 14 Jul 2025 09:45:38 +0200 Subject: [PATCH 1/4] add moderationTemplate to AddChildAsync --- src/IReactions.cs | 8 ++++---- src/Reactions.cs | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/IReactions.cs b/src/IReactions.cs index 971b766..dbb483b 100644 --- a/src/IReactions.cs +++ b/src/IReactions.cs @@ -23,19 +23,19 @@ public interface IReactions /// Adds a new child reaction. /// https://getstream.io/activity-feeds/docs/dotnet-csharp/reactions_introduction/?language=csharp - Task AddChildAsync(string parentId, string reactionId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null); + Task AddChildAsync(string parentId, string reactionId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null); /// Adds a new child reaction. /// https://getstream.io/activity-feeds/docs/dotnet-csharp/reactions_introduction/?language=csharp - Task AddChildAsync(Reaction parent, string reactionId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null); + Task AddChildAsync(Reaction parent, string reactionId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null); /// Adds a new child reaction. /// https://getstream.io/activity-feeds/docs/dotnet-csharp/reactions_introduction/?language=csharp - Task AddChildAsync(string parentId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null); + Task AddChildAsync(string parentId, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null); /// Adds a new child reaction. /// https://getstream.io/activity-feeds/docs/dotnet-csharp/reactions_introduction/?language=csharp - Task AddChildAsync(Reaction parent, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null); + Task AddChildAsync(Reaction parent, string kind, string userId, IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null); /// Deletes a reactions. /// https://getstream.io/activity-feeds/docs/dotnet-csharp/reactions_introduction/?language=csharp diff --git a/src/Reactions.cs b/src/Reactions.cs index 52e3f1f..2faea98 100644 --- a/src/Reactions.cs +++ b/src/Reactions.cs @@ -42,19 +42,19 @@ public async Task AddAsync(string reactionId, string kind, string acti } public async Task AddChildAsync(Reaction parent, string kind, string userId, - IDictionary data = null, IEnumerable targetFeeds = null) + IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null) { - return await AddChildAsync(parent.Id, null, kind, userId, data, targetFeeds); + return await AddChildAsync(parent.Id, null, kind, userId, data, targetFeeds, moderationTemplate); } public async Task AddChildAsync(string parentId, string kind, string userId, - IDictionary data = null, IEnumerable targetFeeds = null) + IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null) { - return await AddChildAsync(parentId, null, kind, userId, data, targetFeeds); + return await AddChildAsync(parentId, null, kind, userId, data, targetFeeds, moderationTemplate); } public async Task AddChildAsync(string parentId, string reactionId, string kind, string userId, - IDictionary data = null, IEnumerable targetFeeds = null) + IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null) { var r = new Reaction() { @@ -64,15 +64,16 @@ public async Task AddChildAsync(string parentId, string reactionId, st Data = data, ParentId = parentId, TargetFeeds = targetFeeds, + ModerationTemplate = moderationTemplate, }; return await AddAsync(r); } public async Task AddChildAsync(Reaction parent, string reactionId, string kind, string userId, - IDictionary data = null, IEnumerable targetFeeds = null) + IDictionary data = null, IEnumerable targetFeeds = null, string moderationTemplate = null) { - return await AddChildAsync(parent.Id, reactionId, kind, userId, data, targetFeeds); + return await AddChildAsync(parent.Id, reactionId, kind, userId, data, targetFeeds, moderationTemplate); } public async Task GetAsync(string reactionId) From fb892132b3738e06d27c03192381b75387df415c Mon Sep 17 00:00:00 2001 From: Varsh Date: Mon, 14 Jul 2025 10:07:19 +0200 Subject: [PATCH 2/4] write test for modTemplate in AddChildAsync --- tests/ModerationTests.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/ModerationTests.cs b/tests/ModerationTests.cs index 4effff3..df73490 100644 --- a/tests/ModerationTests.cs +++ b/tests/ModerationTests.cs @@ -87,6 +87,13 @@ public async Task TestReactionModeration() var updatedResponse2 = updatedReaction2.GetModerationResponse(); Assert.AreEqual("complete", updatedResponse2.Status); Assert.AreEqual("remove", updatedResponse2.RecommendedAction); + + var c1 = await Client.Reactions.AddChildAsync(r.Id, "upvote", "tommy", updatedData, null, "moderation_config_1_reaction"); + Assert.NotNull(c1); + + var updatedResponse2 = c1.GetModerationResponse(); + Assert.AreEqual("complete", c1.Status); + Assert.AreEqual("remove", c1.RecommendedAction); } [Test] @@ -156,4 +163,4 @@ public async Task TestFlagReaction() Assert.NotNull(response); } } -} +} \ No newline at end of file From fb8607f07db4576a975cd0d80dc39ced7635b6b0 Mon Sep 17 00:00:00 2001 From: Varsh Date: Mon, 14 Jul 2025 10:09:32 +0200 Subject: [PATCH 3/4] write test for modTemplate in AddChildAsync --- tests/ModerationTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/ModerationTests.cs b/tests/ModerationTests.cs index df73490..82b8143 100644 --- a/tests/ModerationTests.cs +++ b/tests/ModerationTests.cs @@ -92,8 +92,8 @@ public async Task TestReactionModeration() Assert.NotNull(c1); var updatedResponse2 = c1.GetModerationResponse(); - Assert.AreEqual("complete", c1.Status); - Assert.AreEqual("remove", c1.RecommendedAction); + Assert.AreEqual("complete", updatedResponse2.Status); + Assert.AreEqual("remove", updatedResponse2.RecommendedAction); } [Test] From d2a32219023eebaae1db8fe71b845f27fc0c5da7 Mon Sep 17 00:00:00 2001 From: Varsh Date: Mon, 14 Jul 2025 10:12:37 +0200 Subject: [PATCH 4/4] write test for modTemplate in AddChildAsync --- tests/ModerationTests.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/ModerationTests.cs b/tests/ModerationTests.cs index 82b8143..4e571ee 100644 --- a/tests/ModerationTests.cs +++ b/tests/ModerationTests.cs @@ -90,10 +90,9 @@ public async Task TestReactionModeration() var c1 = await Client.Reactions.AddChildAsync(r.Id, "upvote", "tommy", updatedData, null, "moderation_config_1_reaction"); Assert.NotNull(c1); - - var updatedResponse2 = c1.GetModerationResponse(); - Assert.AreEqual("complete", updatedResponse2.Status); - Assert.AreEqual("remove", updatedResponse2.RecommendedAction); + var updatedResponse3 = c1.GetModerationResponse(); + Assert.AreEqual("complete", updatedResponse3.Status); + Assert.AreEqual("remove", updatedResponse3.RecommendedAction); } [Test]