Skip to content

Commit 057ad24

Browse files
authored
Fix role deserialization. The ChannelMemberRoleType enum is missing values. Note: Role is deprecated so we can just switch it to string to avoid deserialization issues (#143)
1 parent 3ce3056 commit 057ad24

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

Assets/Plugins/StreamChat/Core/InternalDTO/Models/ChannelMemberInternalDTO.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ internal partial class ChannelMemberInternalDTO
7171
/// Permission level of the member in the channel (DEPRECATED: use channel_role instead)
7272
/// </summary>
7373
[Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
74-
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
75-
public ChannelMemberRoleType? Role { get; set; }
74+
public string Role { get; set; }
7675

7776
/// <summary>
7877
/// Whether member is shadow banned in this channel or not

Assets/Plugins/StreamChat/Core/InternalDTO/Requests/ChannelMemberRequestInternalDTO.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ internal partial class ChannelMemberRequestInternalDTO
7171
/// Permission level of the member in the channel (DEPRECATED: use channel_role instead)
7272
/// </summary>
7373
[Newtonsoft.Json.JsonProperty("role", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
74-
[Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
75-
public ChannelMemberRoleType? Role { get; set; }
74+
public string Role { get; set; }
7675

7776
/// <summary>
7877
/// Whether member is shadow banned in this channel or not

Assets/Plugins/StreamChat/Core/LowLevelClient/Models/ChannelMember.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class ChannelMember : ModelBase, ILoadableFrom<ChannelMemberInternalDTO,
5252
/// Permission level of the member in the channel (DEPRECATED: use channel_role instead)
5353
/// </summary>
5454
[Obsolete("Use ChannelRole instead")]
55-
public ChannelMemberRoleType? Role { get; set; }
55+
public string Role { get; set; }
5656

5757
/// <summary>
5858
/// Whether member is shadow banned in this channel or not

Assets/Plugins/StreamChat/Core/LowLevelClient/Requests/ChannelMemberRequest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using StreamChat.Core.Helpers;
1+
using System;
2+
using StreamChat.Core.Helpers;
23
using StreamChat.Core.InternalDTO.Models;
34
using StreamChat.Core.InternalDTO.Requests;
45

@@ -51,7 +52,8 @@ public partial class ChannelMemberRequest : RequestObjectBase, ISavableTo<Channe
5152
/// <summary>
5253
/// Permission level of the member in the channel (DEPRECATED: use channel_role instead)
5354
/// </summary>
54-
public ChannelMemberRoleType? Role { get; set; }
55+
[Obsolete("Use ChannelRole instead")]
56+
public string Role { get; set; }
5557

5658
/// <summary>
5759
/// Whether member is shadow banned in this channel or not

0 commit comments

Comments
 (0)