Search code examples
quickblox

Unable to add users to existing chat in Quickblox JS


I have added a feature to QuickBlox chat sample for JS , which allows to add a new user to existing chat

function addUsers(){

var curDlgId = currentDialog._id ; 
var curDlgName = currentDialog.name; 


$('.users_form.active').each(function(index) {
    users_ids[index] = $(this).attr('id');    
});


QB.chat.dialog.update(curDlgId,{ push_all : {users_ids}}, onAddUsersCompleted);

}

function onAddUsersCompleted(error,b,c){

}

but I am getting an error on onAddUsersCompleted callback :

error = Object {code: 403, status: "error", message: "Forbidden", detail: "{"errors":["You don't have appropriate permissions to perform this operation"]}"}

Whats wrong ?


Solution

  • Ostap, please try to change QB.chat.dialog.update(curDlgId,{ push_all : {users_ids}}, onAddUsersCompleted);

    to QB.chat.dialog.update(curDlgId,{ push_all : users_ids}, onAddUsersCompleted);