fix(member-selector): Adds filter suggestions by chat key pasted in input
Fixes: #9881
This commit is contained in:
parent
e0acf0f195
commit
e34d28f881
|
@ -35,6 +35,7 @@ MembersSelectorBase {
|
||||||
edit.onTextChanged: {
|
edit.onTextChanged: {
|
||||||
// When edited, give a small delay in case next character is printed soon
|
// When edited, give a small delay in case next character is printed soon
|
||||||
contactLookupDelayTimer.start()
|
contactLookupDelayTimer.start()
|
||||||
|
root.pastedChatKey = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
onTextPasted: (text) => {
|
onTextPasted: (text) => {
|
||||||
|
@ -62,7 +63,6 @@ MembersSelectorBase {
|
||||||
property ListModel selectedMembers: ListModel {}
|
property ListModel selectedMembers: ListModel {}
|
||||||
|
|
||||||
function lookupContact(value) {
|
function lookupContact(value) {
|
||||||
|
|
||||||
value = Utils.dropUserLinkPrefix(value.trim())
|
value = Utils.dropUserLinkPrefix(value.trim())
|
||||||
|
|
||||||
if (Utils.isChatKey(value)) {
|
if (Utils.isChatKey(value)) {
|
||||||
|
@ -94,7 +94,8 @@ MembersSelectorBase {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (contactDetails.isContact) {
|
if (contactDetails.isContact) {
|
||||||
root.rootStore.mainModuleInst.switchTo(root.rootStore.getMySectionId(), contactDetails.publicKey)
|
root.pastedChatKey = contactDetails.publicKey
|
||||||
|
root.suggestionsDialog.forceHide = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,8 @@ InlineSelectorPanel {
|
||||||
return localNickname || displayName || aliasName
|
return localNickname || displayName || aliasName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property string pastedChatKey: ""
|
||||||
|
|
||||||
label.text: qsTr("To:")
|
label.text: qsTr("To:")
|
||||||
warningLabel.text: qsTr("%1 USER LIMIT REACHED").arg(membersLimit)
|
warningLabel.text: qsTr("%1 USER LIMIT REACHED").arg(membersLimit)
|
||||||
warningLabel.visible: limitReached
|
warningLabel.visible: limitReached
|
||||||
|
@ -50,9 +52,13 @@ InlineSelectorPanel {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isPastedProfileLinkToContact(pubkey) {
|
||||||
|
return root.pastedChatKey === pubkey
|
||||||
|
}
|
||||||
|
|
||||||
filters: [
|
filters: [
|
||||||
ExpressionFilter {
|
ExpressionFilter {
|
||||||
enabled: root.edit.text !== ""
|
enabled: root.edit.text !== "" && root.pastedChatKey == ""
|
||||||
expression: {
|
expression: {
|
||||||
root.edit.text // ensure expression is reevaluated when edit.text changes
|
root.edit.text // ensure expression is reevaluated when edit.text changes
|
||||||
return _suggestionsModel.searchPredicate(model.displayName, model.localNickname, model.alias)
|
return _suggestionsModel.searchPredicate(model.displayName, model.localNickname, model.alias)
|
||||||
|
@ -63,6 +69,13 @@ InlineSelectorPanel {
|
||||||
root.model.count // ensure expression is reevaluated when members model changes
|
root.model.count // ensure expression is reevaluated when members model changes
|
||||||
return _suggestionsModel.notAMemberPredicate(model.pubKey)
|
return _suggestionsModel.notAMemberPredicate(model.pubKey)
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
ExpressionFilter {
|
||||||
|
enabled: root.pastedChatKey != ""
|
||||||
|
expression: {
|
||||||
|
root.pastedChatKey // ensure expression is reevaluated when members model changes
|
||||||
|
return _suggestionsModel.isPastedProfileLinkToContact(model.pubKey)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue