The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-issuelinks/client.js

18 lines
688 B

import s from 'underscore.string';
//
// IssueLink is a named function that will add issue links
// @param {Object} message - The message object
//
function IssueLink(message) {
if (s.trim(message.html) && RocketChat.settings.get('IssueLinks_Enabled')) {
message.html = message.html.replace(/(?:^|\s|\n)(#[0-9]+)\b/g, function(match, issueNumber) {
const url = RocketChat.settings.get('IssueLinks_Template').replace('%s', issueNumber.substring(1));
return match.replace(issueNumber, `<a href="${ url }" target="_blank">${ issueNumber }</a>`);
});
}
return message;
}
RocketChat.callbacks.add('renderMessage', IssueLink, RocketChat.callbacks.priority.MEDIUM, 'issuelink');