Update channel without posting Message or posting as System message
The documentation for updateChannel says about the updateMessage; parameter "message allowing you to show a system message in the Channel that something changed", however, when I use this, it shows the message like it was the current user that made the update sent the message. For example, I rename a channel, and I want to show a system message not posted as the user making the update, can I achieve this (as the method here suggested) without using hooks? Here's my example code to rename a channel and post a message that channel was renamed by the user.
channel.extraData[NAME] = newName
val message = Message().apply {
text = "Group renamed to $newName"
type = "system"
}
val callback = object : ChannelCallback {
override fun onSuccess(response: ChannelResponse?) {
...
}
override fun onError(errMsg: String?, errCode: Int) {
....
}
}
streamClient.updateChannel(channel, message, callback)
If its not possible to do this, how do I update a channel without providing a value for the updateMessageparameter, because when I try provide that as null, updateChannel fails with the message Attempt to invoke virtual method 'java.util.HashMap com.getstream.sdk.chat.rest.Message.getExtraData()' on a null object reference.
@adrian09h how can I test this as I'm thinking the issue still persists. I'm using a snapshot of master now, and still see the issue. I see that channel successfully updates when I send provide null as the updateMessage, but this behaves like I provided Message() and still posts an empty message from the user who made the update. To see this, if you have another user device (not the one that made the change) that lists the updated channel, you'll see that the last text is empty, which is different from the text shown in the user device that made the change. Also, if you now open the channel, the device that made the change would that someone has read the empty message. Is there a test I can see where this is tested and works as expected
@Chikrix , Let me check soon.