Skip to content

Commit 3b77780

Browse files
Issue when user can't create group chat fixed
1 parent 71fca9f commit 3b77780

File tree

4 files changed

+27
-21
lines changed

4 files changed

+27
-21
lines changed

samples/chat/js/dialog.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function Dialog() {
5353
self._cache[dialog._id] = helpers.compileDialogParams(dialog);
5454
}
5555
if (args !== undefined && args.selected !== undefined) {
56-
self.buildDialogItem(Object.assign({selected: args.selected, isLastMessage:args.isLastMessage}, self._cache[dialog._id]));
56+
self.buildDialogItem(Object.assign({ selected: args.selected, isLastMessage: args.isLastMessage }, self._cache[dialog._id]));
5757
} else {
5858
self.buildDialogItem(self._cache[dialog._id]);
5959
}
@@ -94,7 +94,7 @@ Dialog.prototype.init = function () {
9494
});
9595
};
9696

97-
Dialog.prototype.loadDialogs = function (f, ) {
97+
Dialog.prototype.loadDialogs = function (f,) {
9898
var self = this,
9999
filter = f ? f : {
100100
limit: self.limit,
@@ -158,11 +158,11 @@ Dialog.prototype.renderDialog = function (dialog, setAsFirst) {
158158
var nameIcon = dialog.name.match(/, .*?./);
159159
nameIcon = dialog.name[0] + (nameIcon !== null ? nameIcon[0][2] : '');
160160

161-
var template = helpers.fillTemplate('tpl_userConversations', {dialog: dialog, name: nameIcon});
161+
var template = helpers.fillTemplate('tpl_userConversations', { dialog: dialog, name: nameIcon });
162162
elem = helpers.toHtml(template)[0];
163163

164164

165-
if(self.dialogsListContainer.firstElementChild) {
165+
if (self.dialogsListContainer.firstElementChild) {
166166
console.log(self.dialogsListContainer.firstElementChild.id);
167167
}
168168

@@ -414,7 +414,7 @@ Dialog.prototype.beforeCreateDialog = function () {
414414

415415
if (type !== 3) {
416416
this.params.name = name;
417-
}else{
417+
} else {
418418
this.createDialog();
419419
return false;
420420
}
@@ -461,7 +461,7 @@ Dialog.prototype.createDialog = function () {
461461
params = this.params;
462462

463463
if (type !== 3 && name) {
464-
params.name = this.params.name = name;
464+
params.name = this.params.name = name;
465465
}
466466

467467
if (!app.checkInternetConnection()) {
@@ -479,7 +479,7 @@ Dialog.prototype.createDialog = function () {
479479
id = createdDialog._id,
480480
occupants = createdDialog.occupants_ids,
481481
typeChat = (createdDialog.type === CONSTANTS.DIALOG_TYPES.GROUPCHAT) ? ' the group' : '',
482-
message_body = (app.user.name || app.user.login) + ' created'+typeChat+' chat "'+createdDialog.name+'"',
482+
message_body = (app.user.name || app.user.login) + ' created' + typeChat + ' chat "' + createdDialog.name + '"',
483483
systemMessage = {
484484
extension: {
485485
notification_type: 1,
@@ -542,7 +542,7 @@ Dialog.prototype.getDialogById = function (id) {
542542
if (!app.checkInternetConnection()) {
543543
return false;
544544
}
545-
QB.chat.dialog.list({"_id": id}, function (err, res) {
545+
QB.chat.dialog.list({ "_id": id }, function (err, res) {
546546
if (err) {
547547
console.error(err);
548548
reject(err);
@@ -644,13 +644,13 @@ Dialog.prototype.updateDialog = function (updates) {
644644
updatedMsg.extension.dialog_name = updates.title;
645645
updatedMsg.body = app.user.name + ' changed the conversation name to "' + updates.title + '".';
646646
}
647-
}else if (updates.delete) {
647+
} else if (updates.delete) {
648648

649649
toUpdateParams.pull_all = {
650650
occupants_ids: [app.user.id]
651651
};
652652

653-
}else if (updates.userList) {
653+
} else if (updates.userList) {
654654
newUsers = updates.userList.filter(function (occupantId) {
655655
return dialog.users.indexOf(occupantId) === -1;
656656
});
@@ -789,10 +789,10 @@ Dialog.prototype.quitFromTheDialog = async function (dialogId) {
789789
delete self._cache[dialogId];
790790
delete dialogModule.selectedDialogIds[dialogId];
791791
var dialogElem = document.getElementById(dialogId);
792-
if(dialogElem !== null) {
792+
if (dialogElem !== null) {
793793
dialogElem.parentNode.removeChild(dialogElem);
794794
}
795-
if(dialogId === self.dialogId) {
795+
if (dialogId === self.dialogId) {
796796
self.dialogId = null;
797797
}
798798
}
@@ -839,10 +839,10 @@ Dialog.prototype.initGettingDialogs = function (userListConteiner, userListFilte
839839
});
840840

841841
self.userListConteiner &&
842-
self.userListConteiner.addEventListener('scroll', this.scrollHandler);
842+
self.userListConteiner.addEventListener('scroll', this.scrollHandler);
843843

844844
self.userListFilter &&
845-
self.userListFilter.addEventListener('input', self.filter);
845+
self.userListFilter.addEventListener('input', self.filter);
846846

847847
return this.getDialogs(params);
848848
};
@@ -853,13 +853,13 @@ Dialog.prototype.buildDialogItem = function (user) {
853853

854854
if (user.selected !== undefined) {
855855
userItem.selected = user.selected;
856-
user.event = {click: false};
856+
user.event = { click: false };
857857
}
858858

859-
if(user.isLastMessage === undefined) user.isLastMessage = true;
859+
if (user.isLastMessage === undefined) user.isLastMessage = true;
860860
userItem.isLastMessage = user.isLastMessage;
861861

862-
var userTpl = helpers.fillTemplate('tpl_dialogItem', {user: userItem}),
862+
var userTpl = helpers.fillTemplate('tpl_dialogItem', { user: userItem }),
863863
elem = helpers.toHtml(userTpl)[0];
864864

865865
elem.addEventListener('click', function () {
@@ -883,7 +883,7 @@ Dialog.prototype.buildDialogItem = function (user) {
883883
self.selectedDialogIds.push(elem.id);
884884
}
885885

886-
if(document.querySelector('#selectedDialogIds')) {
886+
if (document.querySelector('#selectedDialogIds')) {
887887
document.querySelector('#selectedDialogIds').innerHTML = self.selectedDialogIds.length === 1 ?
888888
self.selectedDialogIds.length + ' chat selected' :
889889
self.selectedDialogIds.length + ' chats selected';
@@ -909,11 +909,11 @@ Dialog.prototype.setListeners = function () {
909909

910910
helpers._(document).on("input", ".dialog_name", function (_event, _element) {
911911
var dialogName = _element.value.trim();
912-
document.forms.create_dialog.dialog_name.isValid = 20 >= dialogName.length && dialogName.length >=3;
913-
if(document.forms.create_dialog.dialog_name.isNotValid){
912+
document.forms.create_dialog.dialog_name.isValid = 20 >= dialogName.length && dialogName.length >= 3;
913+
if (document.forms.create_dialog.dialog_name.isValid) {
914914
_element.nextElementSibling.classList.remove('filled');
915915
document.querySelector('.j-create_dialog_btn').removeAttribute('disabled');
916-
}else{
916+
} else {
917917
_element.nextElementSibling.classList.add('filled');
918918
document.querySelector('.j-create_dialog_btn').setAttribute('disabled', true);
919919
}

samples/react-chat-ui-kit-init-sample/src/QBconfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export const QBConfig = {
5555
active: 2,
5656
},
5757
debug: true,
58+
enableForwarding: true,
59+
enableReplying: true,
5860
endpoints: {
5961
api: 'api.quickblox.com',
6062
chat: 'chat.quickblox.com',

samples/react-chat-ui-kit-init-with-ai-sample/src/QBconfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ export const QBConfig = {
121121
active: 2,
122122
},
123123
debug: true,
124+
enableForwarding: true,
125+
enableReplying: true,
124126
endpoints: {
125127
api: 'api.quickblox.com',
126128
chat: 'chat.quickblox.com',

samples/react-chat-ui-kit-init-with-token-sample/src/QBconfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ export const QBConfig = {
121121
active: 2,
122122
},
123123
debug: true,
124+
enableForwarding: true,
125+
enableReplying: true,
124126
endpoints: {
125127
api: 'api.quickblox.com',
126128
chat: 'chat.quickblox.com',

0 commit comments

Comments
 (0)