Merge pull request #35214 from Himanshugijawara/feat/mentions-show-email

feat(mentions): show email in mention suggestions to avoid duplicate-name confusion
This commit is contained in:
Ejaaz Khan 2026-01-22 13:19:36 +05:30 committed by GitHub
commit 8aebd9fc1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -393,7 +393,7 @@ def get_names_for_mentions(search_term):
def get_users_for_mentions():
return frappe.get_all(
"User",
fields=["name as id", "full_name as value"],
fields=["name as id", "full_name as value", "email"],
filters={
"name": ["not in", ("Administrator", "Guest")],
"allowed_in_mentions": True,

View file

@ -252,10 +252,12 @@ frappe.ui.form.ControlTextEditor = class ControlTextEditor extends frappe.ui.for
return null;
}
let me = this;
return {
allowedChars: /^[A-Za-z0-9_]*$/,
mentionDenotationChars: ["@"],
isolateCharacter: true,
source: frappe.utils.debounce(async function (search_term, renderList) {
let method =
me.mention_search_method || "frappe.desk.search.get_names_for_mentions";
@ -268,7 +270,8 @@ frappe.ui.form.ControlTextEditor = class ControlTextEditor extends frappe.ui.for
}, 300),
renderItem(item) {
let value = item.value;
return `${value} ${item.is_group ? frappe.utils.icon("users") : ""}`;
let email = item?.email ? `(${item?.email})` : "";
return `${value} ${email} ${item.is_group ? frappe.utils.icon("users") : ""}`;
},
};
}