mirror of
https://github.com/redmine/redmine.git
synced 2025-11-18 03:00:52 +01:00
Allow users to be mentioned using @ in issues and wiki pages (#13919):
* the user must have add watchers permission on that object in order to mention other users * mentioned user will receive a notification email * only visible users who can view the object can be mentioned git-svn-id: http://svn.redmine.org/redmine/trunk@21435 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -1127,9 +1127,13 @@ function inlineAutoComplete(element) {
|
||||
if (element.dataset.tribute === 'true') {return};
|
||||
|
||||
const getDataSource = function(entity) {
|
||||
const dataSources = JSON.parse(rm.AutoComplete.dataSources);
|
||||
const dataSources = rm.AutoComplete.dataSources;
|
||||
|
||||
return dataSources[entity];
|
||||
if (dataSources[entity]) {
|
||||
return dataSources[entity];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
const remoteSearch = function(url, cb) {
|
||||
@@ -1187,6 +1191,26 @@ function inlineAutoComplete(element) {
|
||||
menuItemTemplate: function (wikiPage) {
|
||||
return sanitizeHTML(wikiPage.original.label);
|
||||
}
|
||||
},
|
||||
{
|
||||
trigger: '@',
|
||||
lookup: function (user, mentionText) {
|
||||
return user.name + user.firstname + user.lastname + user.login;
|
||||
},
|
||||
values: function (text, cb) {
|
||||
const url = getDataSource('users');
|
||||
if (url) {
|
||||
remoteSearch(url + text, function (users) {
|
||||
return cb(users);
|
||||
});
|
||||
}
|
||||
},
|
||||
menuItemTemplate: function (user) {
|
||||
return user.original.name;
|
||||
},
|
||||
selectTemplate: function (user) {
|
||||
return '@' + user.original.login;
|
||||
}
|
||||
}
|
||||
],
|
||||
noMatchTemplate: ""
|
||||
|
||||
Reference in New Issue
Block a user