mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
rename tributeValues to mentionValues (#25375)
Very simple change, just rename this variable so it does not feature the name of the module.
This commit is contained in:
parent
33cd74ad70
commit
ef6f5f0124
5 changed files with 6 additions and 6 deletions
|
@ -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 -}}
|
||||
|
|
|
@ -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 `
|
||||
|
|
|
@ -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'},
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]]);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue