From 9098aa61462c0073eccab7d1054bee33f7128a68 Mon Sep 17 00:00:00 2001 From: TildaDares Date: Thu, 10 Jun 2021 15:59:39 +0100 Subject: [PATCH] fixed name displaying as undefined --- app/assets/javascripts/atWhoAutoComplete.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/atWhoAutoComplete.js b/app/assets/javascripts/atWhoAutoComplete.js index 9ac3f3090ee..374c5b24132 100644 --- a/app/assets/javascripts/atWhoAutoComplete.js +++ b/app/assets/javascripts/atWhoAutoComplete.js @@ -2,9 +2,12 @@ // settings at https://github.com/ichord/At.js/wiki/Base-Document#settings + const displayName = (item) => item.username ? item.username : item.name; + var at_config = { at: "@", - displayTpl: (item) => `
  • ${item.username ? item.username : item.name}
  • `, + displayTpl: (item) => `
  • ${displayName(item)}
  • `, + insertTpl: (item) => `@${displayName(item)}`, data: '/users/active', delay: 400, callbacks: {