mirror of
https://github.com/wekan/wekan.git
synced 2025-12-17 16:00:13 +01:00
User mentions now return @username (full name)
This commit is contained in:
parent
e176410b54
commit
a160b662ef
2 changed files with 14 additions and 5 deletions
|
|
@ -11,7 +11,7 @@ BlazeComponent.extendComponent({
|
||||||
const mentions = [
|
const mentions = [
|
||||||
// User mentions
|
// User mentions
|
||||||
{
|
{
|
||||||
match: /\B@([\w.]*)$/,
|
match: /\B@([\w.-]*)$/,
|
||||||
search(term, callback) {
|
search(term, callback) {
|
||||||
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
const currentBoard = Boards.findOne(Session.get('currentBoard'));
|
||||||
callback(
|
callback(
|
||||||
|
|
@ -21,8 +21,17 @@ BlazeComponent.extendComponent({
|
||||||
.map(member => {
|
.map(member => {
|
||||||
const user = Users.findOne(member.userId);
|
const user = Users.findOne(member.userId);
|
||||||
const username = user.username;
|
const username = user.username;
|
||||||
const fullName = user.profile && user.profile !== undefined ? user.profile.fullname : "";
|
const fullName = user.profile && user.profile !== undefined && user.profile.fullname ? user.profile.fullname : "";
|
||||||
return username.includes(term) || fullName.includes(term) ? fullName + "(" + username + ")" : null;
|
// return username.includes(term) || fullName.includes(term) ? fullName + "(" + username + ")" : null;
|
||||||
|
if (username.includes(term) || fullName.includes(term)) {
|
||||||
|
if (fullName) {
|
||||||
|
return username + " (" + fullName + ")";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
})
|
})
|
||||||
.filter(Boolean), [...specialHandleNames])
|
.filter(Boolean), [...specialHandleNames])
|
||||||
);
|
);
|
||||||
|
|
@ -355,7 +364,7 @@ Blaze.Template.registerHelper(
|
||||||
}
|
}
|
||||||
return member;
|
return member;
|
||||||
}), [...specialHandles]);
|
}), [...specialHandles]);
|
||||||
const mentionRegex = /\B@([\w.]*)/gi;
|
const mentionRegex = /\B@([\w.-]*)/gi;
|
||||||
|
|
||||||
let currentMention;
|
let currentMention;
|
||||||
while ((currentMention = mentionRegex.exec(content)) !== null) {
|
while ((currentMention = mentionRegex.exec(content)) !== null) {
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ if (Meteor.isServer) {
|
||||||
}
|
}
|
||||||
return member;
|
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;
|
let currentMention;
|
||||||
while ((currentMention = mentionRegex.exec(comment)) !== null) {
|
while ((currentMention = mentionRegex.exec(comment)) !== null) {
|
||||||
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
|
/*eslint no-unused-vars: ["error", { "varsIgnorePattern": "[iI]gnored" }]*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue