mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
lint fixes
This commit is contained in:
@@ -168,7 +168,7 @@ export default async function highlightMentions (text) {
|
|||||||
members = await User
|
members = await User
|
||||||
.find({
|
.find({
|
||||||
$or: usernameRegexes.map(regex => ({ 'auth.local.username': regex })),
|
$or: usernameRegexes.map(regex => ({ 'auth.local.username': regex })),
|
||||||
'flags.verifiedUsername': true
|
'flags.verifiedUsername': true,
|
||||||
})
|
})
|
||||||
.select(['auth.local.username', '_id', 'preferences.pushNotifications', 'pushDevices', 'party', 'guilds'])
|
.select(['auth.local.username', '_id', 'preferences.pushNotifications', 'pushDevices', 'party', 'guilds'])
|
||||||
.lean()
|
.lean()
|
||||||
@@ -178,12 +178,10 @@ export default async function highlightMentions (text) {
|
|||||||
const { username } = member.auth.local;
|
const { username } = member.auth.local;
|
||||||
const regex = new RegExp(`@${escapeRegExp(username)}(?![\\-\\w])`, 'gi');
|
const regex = new RegExp(`@${escapeRegExp(username)}(?![\\-\\w])`, 'gi');
|
||||||
|
|
||||||
textBlocks.transformValidBlocks(blockText =>
|
textBlocks.transformValidBlocks(blockText => blockText.replace(regex, match => {
|
||||||
blockText.replace(regex, match => {
|
const mentionedUsername = match.substr(1);
|
||||||
const mentionedUsername = match.substr(1);
|
return `[@${mentionedUsername}](${baseUrl}/profile/${member._id})`;
|
||||||
return `[@${mentionedUsername}](${baseUrl}/profile/${member._id})`;
|
}));
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user