Skip to content

Commit ba543be

Browse files
[CHA-0] Add user_message_reminders field to ChannelType for channel type updates (#219)
* changed filter conditions to filter * updated testcases * removed unwanted changes * fixed linting * feat: Add user_message_reminders field to ChannelType for channel type updates * feat: Add test for user_message_reminders field in ChannelType * fix: Remove trailing whitespace from ChannelTypeTest for Spotless compliance * fix: Handle Push V3 requirement in user_message_reminders test gracefully * fix: Update user_message_reminders test to not require Push V3 * fix: Format test code for Spotless compliance
1 parent 34344ae commit ba543be

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

src/main/java/io/getstream/chat/java/models/ChannelType.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class ChannelType {
4545
@JsonProperty("reminders")
4646
private Boolean reminders;
4747

48+
@Nullable
49+
@JsonProperty("user_message_reminders")
50+
private Boolean userMessageReminders;
51+
4852
@Nullable
4953
@JsonProperty("connect_events")
5054
private Boolean connectEvents;
@@ -330,6 +334,10 @@ public static class ChannelTypeCreateRequestData {
330334
@JsonProperty("reminders")
331335
protected Boolean reminders;
332336

337+
@Nullable
338+
@JsonProperty("user_message_reminders")
339+
protected Boolean userMessageReminders;
340+
333341
@Nullable
334342
@JsonProperty("connect_events")
335343
protected Boolean connectEvents;
@@ -477,6 +485,10 @@ public static class ChannelTypeUpdateRequestData {
477485
@JsonProperty("reminders")
478486
protected Boolean reminders;
479487

488+
@Nullable
489+
@JsonProperty("user_message_reminders")
490+
protected Boolean userMessageReminders;
491+
480492
@Nullable
481493
@JsonProperty("connect_events")
482494
protected Boolean connectEvents;

src/test/java/io/getstream/chat/java/ChannelTypeTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,29 @@ void whenManipulatingChannelTypeWithGrants_throwsNoException() {
168168
return new HashSet<>(actualGrants).equals(new HashSet<>(expectedGrants));
169169
});
170170
}
171+
172+
@DisplayName("Can set user_message_reminders field on channel type")
173+
@Test
174+
void whenSettingUserMessageRemindersOnChannelType_thenFieldIsAccessible() {
175+
String channelTypeName = RandomStringUtils.randomAlphabetic(10);
176+
177+
// Create a basic channel type first
178+
Assertions.assertDoesNotThrow(
179+
() -> ChannelType.create().withDefaultConfig().name(channelTypeName).request());
180+
pause();
181+
182+
// Test that the field can be set (even if Push V3 is not enabled, the field should be settable)
183+
// The API will reject enabling it without Push V3, but the field should still be in the model
184+
Assertions.assertDoesNotThrow(
185+
() -> ChannelType.update(channelTypeName).userMessageReminders(false).request());
186+
pause();
187+
188+
// Retrieve and verify the field is accessible
189+
var retrieved = Assertions.assertDoesNotThrow(() -> ChannelType.get(channelTypeName).request());
190+
Assertions.assertEquals(channelTypeName, retrieved.getName());
191+
// The field should be present in the response (even if false)
192+
Assertions.assertNotNull(retrieved.getUserMessageReminders());
193+
194+
Assertions.assertDoesNotThrow(() -> ChannelType.delete(channelTypeName));
195+
}
171196
}

0 commit comments

Comments
 (0)