summaryrefslogtreecommitdiffstats
path: root/web_src/js/utils/match.js
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-12 16:36:23 +0800
committerGitHub <noreply@github.com>2023-08-12 08:36:23 +0000
commit74930b1ccd9acacd1ddaa30d1b4849b0e4570d7c (patch)
treec67b4878f2bf7b47278283be4e9cd6f73ed7990d /web_src/js/utils/match.js
parent2fc0eb913caf40aec056d49f5838992e136208a2 (diff)
downloadgitea-74930b1ccd9acacd1ddaa30d1b4849b0e4570d7c.tar.gz
gitea-74930b1ccd9acacd1ddaa30d1b4849b0e4570d7c.zip
Avoiding accessing undefined mentionValues (#26461)
The `window.config.mentionValues` might be undefined: ``` {{if or .Participants .Assignees .MentionableTeams}} mentionValues: ... {{end}} ```
Diffstat (limited to 'web_src/js/utils/match.js')
-rw-r--r--web_src/js/utils/match.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/web_src/js/utils/match.js b/web_src/js/utils/match.js
index 029fec8840..17fdfed113 100644
--- a/web_src/js/utils/match.js
+++ b/web_src/js/utils/match.js
@@ -32,7 +32,7 @@ export function matchMention(queryText) {
// results is a map of weights, lower is better
const results = new Map();
- for (const obj of window.config.mentionValues) {
+ for (const obj of window.config.mentionValues ?? []) {
const index = obj.key.toLowerCase().indexOf(query);
if (index === -1) continue;
const existing = results.get(obj);