Use board users for @-mentioning
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -26,9 +26,10 @@ import CommentCollection from '../legacy/commentcollection';
|
|||||||
import CommentModel from '../legacy/commentmodel';
|
import CommentModel from '../legacy/commentmodel';
|
||||||
|
|
||||||
class ActivityController {
|
class ActivityController {
|
||||||
constructor ($scope, CardService, ActivityService) {
|
constructor ($scope, CardService, ActivityService, BoardService) {
|
||||||
'ngInject';
|
'ngInject';
|
||||||
this.cardservice = CardService;
|
this.cardservice = CardService;
|
||||||
|
this.boardservice = BoardService;
|
||||||
this.activityservice = ActivityService;
|
this.activityservice = ActivityService;
|
||||||
this.$scope = $scope;
|
this.$scope = $scope;
|
||||||
this.type = '';
|
this.type = '';
|
||||||
@@ -59,8 +60,12 @@ class ActivityController {
|
|||||||
}
|
}
|
||||||
$target.atwho({
|
$target.atwho({
|
||||||
at: "@",
|
at: "@",
|
||||||
data:[{id: 'johndoe', label: 'John Doe'}],
|
|
||||||
callbacks: {
|
callbacks: {
|
||||||
|
remoteFilter: function(query, callback) {
|
||||||
|
let uids = self.boardservice.getUsers();
|
||||||
|
uids = uids.filter(x => x.uid.toLowerCase().includes(query.toLowerCase()) || x.displayname.toLowerCase().includes(query.toLowerCase()));
|
||||||
|
callback(uids);
|
||||||
|
},
|
||||||
highlighter: function (li) {
|
highlighter: function (li) {
|
||||||
// misuse the highlighter callback to instead of
|
// misuse the highlighter callback to instead of
|
||||||
// highlighting loads the avatars.
|
// highlighting loads the avatars.
|
||||||
@@ -74,22 +79,22 @@ class ActivityController {
|
|||||||
return '<li>' +
|
return '<li>' +
|
||||||
'<span class="avatar-name-wrapper">' +
|
'<span class="avatar-name-wrapper">' +
|
||||||
'<span class="avatar" ' +
|
'<span class="avatar" ' +
|
||||||
'data-username="' + escapeHTML(item.id) + '" ' + // for avatars
|
'data-username="' + escapeHTML(item.uid) + '" ' + // for avatars
|
||||||
'data-user="' + escapeHTML(item.id) + '" ' + // for contactsmenu
|
'data-user="' + escapeHTML(item.uid) + '" ' + // for contactsmenu
|
||||||
'data-user-display-name="' + escapeHTML(item.label) + '">' +
|
'data-user-display-name="' + escapeHTML(item.displayname) + '">' +
|
||||||
'</span>' +
|
'</span>' +
|
||||||
'<strong>' + escapeHTML(item.label) + '</strong>' +
|
'<strong>' + escapeHTML(item.displayname) + '</strong>' +
|
||||||
'</span></li>';
|
'</span></li>';
|
||||||
},
|
},
|
||||||
insertTpl: function (item) {
|
insertTpl: function (item) {
|
||||||
return '' +
|
return '' +
|
||||||
'<span class="avatar-name-wrapper">' +
|
'<span class="avatar-name-wrapper">' +
|
||||||
'<span class="avatar" ' +
|
'<span class="avatar" ' +
|
||||||
'data-username="' + escapeHTML(item.id) + '" ' + // for avatars
|
'data-username="' + escapeHTML(item.uid) + '" ' + // for avatars
|
||||||
'data-user="' + escapeHTML(item.id) + '" ' + // for contactsmenu
|
'data-user="' + escapeHTML(item.uid) + '" ' + // for contactsmenu
|
||||||
'data-user-display-name="' + escapeHTML(item.label) + '">' +
|
'data-user-display-name="' + escapeHTML(item.displayname) + '">' +
|
||||||
'</span>' +
|
'</span>' +
|
||||||
'<strong>' + escapeHTML(item.label) + '</strong>' +
|
'<strong>' + escapeHTML(item.displayname) + '</strong>' +
|
||||||
'</span>';
|
'</span>';
|
||||||
},
|
},
|
||||||
searchKey: "label"
|
searchKey: "label"
|
||||||
|
|||||||
Reference in New Issue
Block a user