Skip to content

Commit ef6f5f0

Browse files
authored
rename tributeValues to mentionValues (#25375)
Very simple change, just rename this variable so it does not feature the name of the module.
1 parent 33cd74a commit ef6f5f0

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

templates/base/head_script.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly.
1717
notificationSettings: {{NotificationSettings}}, {{/*a map provided by NewFuncMap in helper.go*/}}
1818
enableTimeTracking: {{EnableTimetracking}},
1919
{{if or .Participants .Assignees .MentionableTeams}}
20-
tributeValues: Array.from(new Map([
20+
mentionValues: Array.from(new Map([
2121
{{- range .Participants -}}
2222
['{{.Name}}', {key: '{{.Name}} {{.FullName}}', value: '{{.Name}}', name: '{{.Name}}', fullname: '{{.FullName}}', avatar: '{{.AvatarLink $.Context}}'}],
2323
{{- end -}}

web_src/js/features/tribute.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function makeCollections({mentions, emoji}) {
3131

3232
if (mentions) {
3333
collections.push({
34-
values: window.config.tributeValues,
34+
values: window.config.mentionValues,
3535
requireLeadingSpace: true,
3636
menuItemTemplate: (item) => {
3737
return `

web_src/js/test/setup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ window.config = {
33
pageData: {},
44
i18n: {},
55
appSubUrl: '',
6-
tributeValues: [
6+
mentionValues: [
77
{key: 'user1 User 1', value: 'user1', name: 'user1', fullname: 'User 1', avatar: 'https://avatar1.com'},
88
{key: 'user2 User 2', value: 'user2', name: 'user2', fullname: 'User 2', avatar: 'https://avatar2.com'},
99
{key: 'user3 User 3', value: 'user3', name: 'user3', fullname: 'User 3', avatar: 'https://avatar3.com'},

web_src/js/utils/match.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function matchMention(queryText) {
3232

3333
// results is a map of weights, lower is better
3434
const results = new Map();
35-
for (const obj of window.config.tributeValues) {
35+
for (const obj of window.config.mentionValues) {
3636
const index = obj.key.toLowerCase().indexOf(query);
3737
if (index === -1) continue;
3838
const existing = results.get(obj);

web_src/js/utils/match.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ test('matchEmoji', () => {
4242
});
4343

4444
test('matchMention', () => {
45-
expect(matchMention('')).toEqual(window.config.tributeValues.slice(0, 6));
46-
expect(matchMention('user4')).toEqual([window.config.tributeValues[3]]);
45+
expect(matchMention('')).toEqual(window.config.mentionValues.slice(0, 6));
46+
expect(matchMention('user4')).toEqual([window.config.mentionValues[3]]);
4747
});

0 commit comments

Comments
 (0)