mirror of
https://github.com/wekan/wekan.git
synced 2026-02-04 15:41:52 +01:00
commit
65b7d3d50d
3 changed files with 20 additions and 11 deletions
|
|
@ -336,7 +336,7 @@ BlazeComponent.extendComponent({
|
|||
[
|
||||
// User mentions
|
||||
{
|
||||
match: /\B@([\w.]*)$/,
|
||||
match: /\B@([\w.-]*)$/,
|
||||
search(term, callback) {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
callback(
|
||||
|
|
@ -347,6 +347,9 @@ BlazeComponent.extendComponent({
|
|||
);
|
||||
},
|
||||
template(user) {
|
||||
if (user.profile && user.profile.fullname) {
|
||||
return (user.username + " (" + user.profile.fullname + ")");
|
||||
}
|
||||
return user.username;
|
||||
},
|
||||
replace(user) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
|
|||
const mentions = [
|
||||
// User mentions
|
||||
{
|
||||
match: /\B@([\w.]*)$/,
|
||||
match: /\B@([\w.-]*)$/,
|
||||
search(term, callback) {
|
||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||
callback(
|
||||
|
|
@ -21,17 +21,23 @@ BlazeComponent.extendComponent({
|
|||
.map(member => {
|
||||
const user = Users.findOne(member.userId);
|
||||
const username = user.username;
|
||||
const fullName = user.profile && user.profile !== undefined ? user.profile.fullname : "";
|
||||
return username.includes(term) || fullName.includes(term) ? fullName + "(" + username + ")" : null;
|
||||
const fullName = user.profile && user.profile !== undefined && user.profile.fullname ? user.profile.fullname : "";
|
||||
return username.includes(term) || fullName.includes(term) ? user : null;
|
||||
})
|
||||
.filter(Boolean), [...specialHandleNames])
|
||||
.filter(Boolean), [...specialHandles])
|
||||
);
|
||||
},
|
||||
template(value) {
|
||||
return value;
|
||||
template(user) {
|
||||
if (user.profile && user.profile.fullname) {
|
||||
return (user.profile.fullname + " (" + user.username + ")");
|
||||
}
|
||||
return user.username;
|
||||
},
|
||||
replace(username) {
|
||||
return `@${username} `;
|
||||
replace(user) {
|
||||
if (user.profile && user.profile.fullname) {
|
||||
return `@${user.username} (${user.profile.fullname}) `;
|
||||
}
|
||||
return `@${user.username} `;
|
||||
},
|
||||
index: 1,
|
||||
},
|
||||
|
|
@ -355,7 +361,7 @@ Blaze.Template.registerHelper(
|
|||
}
|
||||
return member;
|
||||
}), [...specialHandles]);
|
||||
const mentionRegex = /\B@([\w.]*)/gi;
|
||||
const mentionRegex = /\B@([\w.-]*)/gi;
|
||||
|
||||
let currentMention;
|
||||
while ((currentMention = mentionRegex.exec(content)) !== null) {
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@ if (Meteor.isServer) {
|
|||
}
|
||||
return member;
|
||||
});
|
||||
const mentionRegex = /\B@(?:(?:"([\w.\s]*)")|([\w.]+))/gi; // including space in username
|
||||
const mentionRegex = /\B@(?:(?:"([\w.\s-]*)")|([\w.-]+))/gi; // including space in username
|
||||
let currentMention;
|
||||
while ((currentMention = mentionRegex.exec(comment)) !== null) {
|
||||
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue