Updating Group Details without changing the password

How to update group details without changing the password?

I’m trying to update the group’s icon, name, description without changing the password.

Base on the docs:

var group = new Group(String GUID, String name, String groupType, String password, String icon, String description)

You should pass string in this order.

Thanks.

1 Like

Hello @markrec,

Can you please let us know what error are you getting exactly? Also, a password type group can be updated only by admins, moderators, and owners. Participants cannot update group details.

1 Like

I’m not getting an error. I’m just asking if it’s possible to update just one specific info of the group. Cause I want to separate the changing of group password from updating the group icon, name and description. Thanks!

1 Like

Hello @markrec,

Yes, it is possible to update a group without changing the password of the group. However to change any specific detail of the group you need to pass the updated details along with the remaining details of the group along with the new detail you wish to update. For example, If you want to update a group description and want to keep all the other details as it is, you can do so by sending the group object as below:

new Group("GUID_OF_GROUP", "PREVIOUS_GROUP_NAME", "GROUP_TYPE", "PASSWORD_OF_THE_GROUP", "PREVIOUS_ICON_VALUE", "NEW_DESCRIPTION_OF_THE_GROUP")

Also, once you set any specific details you would not be able to unset those values. For example: Once you set the description of the group, you cannot set it to an empty description.

We have created a GitHub issue for this. You can watch the issue here to stay updated.

1 Like

When I’m only trying to update the Group Description, I still need to provide all previous details of the group. But as far as I know, there’s no way to get the previous Group Password, and setting it as an empty string makes it invalid. Thanks.

1 Like

Hello @markrec,

We do understand the issue you are facing. Currently, you would not be able to update a group without providing the password. We have identified the issue at our end and we are working on a fix. We have created an issue on GitHub. You can stay updated by watching the GitHub issue. I have shared the link in my previous reply.

I appreciate your patience. Thank You

1 Like

Hello @markrec,

We have fixed this issue in our latest version of cordova-ionic-sdk (v2.0.6). Please check the same and do let us know if you face any issues.

What data should I pass on new Group() now? Can you give me an example on how to use it? Thanks.

Hello @markrec,

To update a group’s description without changing the password you can use the following:

var group  = new CometChat.group(guid);
group.setDescription("new description");
group.setIcon("link_of_the_icon");

CometChat.updateGroup(group).then(
    Group => { 
        console.log("updated group", Group);
    },err => {
        console.log("error while updating group", err);
    }
);

You can refer to our documentation here: https://prodocs.cometchat.com/docs/cordova-ionic-groups-update-group#section-update-group

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.