Skip to content

Commit b327add

Browse files
author
github-actions
committed
chore: include deleted reactions in getreactions
1 parent d41df99 commit b327add

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/main/java/io/getstream/client/ReactionsClient.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ public CompletableFuture<Reaction> get(String id) throws StreamException {
3636

3737
public CompletableFuture<ReactionBatch> getBatch(List<String> ids) throws StreamException {
3838
final Token token = buildReactionsToken(secret, TokenAction.READ);
39-
return reactions.getBatchReactions(token, ids);
39+
return reactions.getBatchReactions(token, ids, false);
4040
}
41+
42+
public CompletableFuture<ReactionBatch> getBatch(List<String> ids, Boolean includeDeleted) throws StreamException {
43+
final Token token = buildReactionsToken(secret, TokenAction.READ);
44+
return reactions.getBatchReactions(token, ids, includeDeleted);
45+
}
4146

4247
public CompletableFuture<List<Reaction>> filter(LookupKind lookup, String id)
4348
throws StreamException {

src/main/java/io/getstream/core/StreamReactions.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,18 +344,23 @@ public CompletableFuture<Void> restore(Token token, String id) throws StreamExce
344344
}
345345
}
346346

347-
public CompletableFuture<ReactionBatch> getBatchReactions(Token token, List<String> ids) throws StreamException {
347+
public CompletableFuture<ReactionBatch> getBatchReactions(Token token, List<String> ids, Boolean includeDeleted) throws StreamException {
348348
checkNotNull(ids, "Reaction IDs can't be null");
349349
checkArgument(!ids.isEmpty(), "Reaction IDs can't be empty");
350350

351351
try {
352352
final URL url = buildGetReactionsBatchURL(baseURL);
353353
RequestOption optionIds =
354354
new CustomQueryParameter(
355-
"ids", String.join(",", ids));
355+
"ids", String.join(",", ids)
356+
);
357+
RequestOption includeDeletedOption =
358+
new CustomQueryParameter(
359+
"include_deleted", includeDeleted.toString()
360+
);
356361

357362
return httpClient
358-
.execute(buildGet(url, key, token, optionIds))
363+
.execute(buildGet(url, key, token, optionIds, includeDeletedOption))
359364
.thenApply(
360365
response -> {
361366
try {

src/test/java/io/getstream/client/ReactionsClientTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,17 @@ public void batchFetchReactions() throws Exception {
116116
assertEquals(req.getActivityID(), r.getActivityID());
117117
assertEquals(req.getKind(), r.getKind());
118118
}
119+
120+
client.reactions().delete(r1.getId()).join();
121+
response = client.reactions().getBatch(List.of(r1.getId(), r2.getId(), r3.getId(), r4.getId(), r5.getId(), r6.getId()), true).join();
122+
result = response.getReactions();
123+
//Deleted reaction should be present in the response
124+
assertEquals(6, resultMap.size());
125+
for (Reaction r : result) {
126+
Reaction req = reactionsRequest.get(r.getId());
127+
assertEquals(req.getActivityID(), r.getActivityID());
128+
assertEquals(req.getKind(), r.getKind());
129+
}
119130
}
120131

121132
@Test

0 commit comments

Comments
 (0)