From ef6f5f01242421fd9df832f6143ed21693938838 Mon Sep 17 00:00:00 2001
From: silverwind <me@silverwind.io>
Date: Tue, 20 Jun 2023 05:32:49 +0200
Subject: [PATCH] rename tributeValues to mentionValues (#25375)

Very simple change, just rename this variable so it does not feature the
name of the module.
---
 templates/base/head_script.tmpl | 2 +-
 web_src/js/features/tribute.js  | 2 +-
 web_src/js/test/setup.js        | 2 +-
 web_src/js/utils/match.js       | 2 +-
 web_src/js/utils/match.test.js  | 4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl
index b6475a83cd..c7477ff4c0 100644
--- a/templates/base/head_script.tmpl
+++ b/templates/base/head_script.tmpl
@@ -17,7 +17,7 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
 		notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
 		enableTimeTracking: {{EnableTimetracking}},
 		{{if or .Participants .Assignees .MentionableTeams}}
-		tributeValues: Array.from(new Map([
+		mentionValues: Array.from(new Map([
 			{{- range .Participants -}}
 				['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}],
 			{{- end -}}
diff --git a/web_src/js/features/tribute.js b/web_src/js/features/tribute.js
index e77ba29950..43fa79b2a4 100644
--- a/web_src/js/features/tribute.js
+++ b/web_src/js/features/tribute.js
@@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {
 
   if (mentions) {
     collections.push({
-      values: window.config.tributeValues,
+      values: window.config.mentionValues,
       requireLeadingSpace: true,
       menuItemTemplate: (item) => {
         return `
diff --git a/web_src/js/test/setup.js b/web_src/js/test/setup.js
index d9f0b8b547..0b57193674 100644
--- a/web_src/js/test/setup.js
+++ b/web_src/js/test/setup.js
@@ -3,7 +3,7 @@ window.config = {
   pageData: {},
   i18n: {},
   appSubUrl: '',
-  tributeValues: [
+  mentionValues: [
     {key: 'user1 User 1', value: 'user1', name: 'user1', fullname: 'User 1', avatar: 'https://avatar1.com'},
     {key: 'user2 User 2', value: 'user2', name: 'user2', fullname: 'User 2', avatar: 'https://avatar2.com'},
     {key: 'user3 User 3', value: 'user3', name: 'user3', fullname: 'User 3', avatar: 'https://avatar3.com'},
diff --git a/web_src/js/utils/match.js b/web_src/js/utils/match.js
index 31763b0940..029fec8840 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.tributeValues) {
+  for (const obj of window.config.mentionValues) {
     const index = obj.key.toLowerCase().indexOf(query);
     if (index === -1) continue;
     const existing = results.get(obj);
diff --git a/web_src/js/utils/match.test.js b/web_src/js/utils/match.test.js
index 78710f2a5f..f73ec56f8e 100644
--- a/web_src/js/utils/match.test.js
+++ b/web_src/js/utils/match.test.js
@@ -42,6 +42,6 @@ test('matchEmoji', () => {
 });
 
 test('matchMention', () => {
-  expect(matchMention('')).toEqual(window.config.tributeValues.slice(0, 6));
-  expect(matchMention('user4')).toEqual([window.config.tributeValues[3]]);
+  expect(matchMention('')).toEqual(window.config.mentionValues.slice(0, 6));
+  expect(matchMention('user4')).toEqual([window.config.mentionValues[3]]);
 });