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:
Marius Balteanu
2022-02-23 21:16:18 +00:00
parent 3a6c43deee
commit ba74ba1c70
16 changed files with 469 additions and 29 deletions

View File

@@ -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: ""