summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2022-02-23 21:16:18 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2022-02-23 21:16:18 +0000
commitba74ba1c702e7a122328094341e659c2baf9fd3d (patch)
treeb6d43d8beaf9538ff54bebd16768f29f7ef782a6 /public
parent3a6c43deeec8f9f444008e43f53e58a6614716ed (diff)
downloadredmine-ba74ba1c702e7a122328094341e659c2baf9fd3d.tar.gz
redmine-ba74ba1c702e7a122328094341e659c2baf9fd3d.zip
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
Diffstat (limited to 'public')
-rw-r--r--public/javascripts/application.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 5552952cd..91da19229 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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: ""