fix(GroupChatPanel): drop down was showing empty entries

Closes #5955
This commit is contained in:
Alexandra Betouni 2022-06-06 16:45:26 +03:00 committed by Alexandra Betouni
parent a19b17aeac
commit af2f387961
2 changed files with 14 additions and 15 deletions

View File

@ -32,6 +32,15 @@ RowLayout {
removedMembersIds = [] removedMembersIds = []
tagSelector.namesModel.clear() tagSelector.namesModel.clear()
} }
function find(val, array) {
for(var i = 0; i < array.length; i++) {
if(array[i] === val) {
return true
}
}
return false
}
} }
ListView { ListView {
@ -80,7 +89,7 @@ RowLayout {
var entry2 = contactsModelListView.itemAtIndex(j) var entry2 = contactsModelListView.itemAtIndex(j)
d.contactsModel.insert(d.contactsModel.count, d.contactsModel.insert(d.contactsModel.count,
{"pubKey": entry2.pubKey, {"pubKey": entry2.pubKey,
"name": entry2.name, "displayName": entry2.name,
"icon": entry2.icon, "icon": entry2.icon,
"isIdenticon": false, "isIdenticon": false,
"onlineStatus": false}) "onlineStatus": false})
@ -105,17 +114,8 @@ RowLayout {
return exists return exists
} }
function find(val, array) {
for(var i = 0; i < array.length; i++) {
if(array[i] === val) {
return true
}
}
return false
}
function addNewMember(memberId) { function addNewMember(memberId) {
if(find(memberId, d.addedMembersIds)) { if(d.find(memberId, d.addedMembersIds)) {
return return
} }
@ -123,13 +123,13 @@ RowLayout {
d.addedMembersIds.push(memberId) d.addedMembersIds.push(memberId)
} }
if(memberExists(memberId) && find(memberId, d.removedMembersIds)) { if(memberExists(memberId) && d.find(memberId, d.removedMembersIds)) {
d.removedMembersIds.pop(memberId) d.removedMembersIds.pop(memberId)
} }
} }
function removeExistingMember(memberId) { function removeExistingMember(memberId) {
if(find(memberId, d.removedMembersIds)) { if(d.find(memberId, d.removedMembersIds)) {
return return
} }
@ -137,7 +137,7 @@ RowLayout {
d.removedMembersIds.push(memberId) d.removedMembersIds.push(memberId)
} }
if(!memberExists(memberId) && find(memberId, d.addedMembersIds)) { if(!memberExists(memberId) && d.find(memberId, d.addedMembersIds)) {
d.addedMembersIds.pop(memberId) d.addedMembersIds.pop(memberId)
} }
} }

View File

@ -50,7 +50,6 @@ Page {
tagSelector.sortModel(root.contactsModel); tagSelector.sortModel(root.contactsModel);
} else { } else {
tagSelector.namesModel.clear(); tagSelector.namesModel.clear();
contactsModel.clear();
} }
} }
} }