diff --git a/src/shared/chat/templates/unfurl.js b/src/shared/chat/templates/unfurl.js index 12d50ff42..9d3fbc11c 100644 --- a/src/shared/chat/templates/unfurl.js +++ b/src/shared/chat/templates/unfurl.js @@ -7,7 +7,7 @@ export default (o) => { ${ o.image && u.isImageDomainAllowed(o.image) ? html`` : '' }
${o.title}
-

${u.addHyperlinks(o.description)}

+

${u.getURI(o.url).domain()}

`; diff --git a/src/utils/html.js b/src/utils/html.js index 39e8d1e7d..8747dfcef 100644 --- a/src/utils/html.js +++ b/src/utils/html.js @@ -356,38 +356,6 @@ u.filterQueryParamsFromURL = function (url) { return parsed_uri.removeQuery(paramsArray).toString(); }; -u.addHyperlinks = function (text) { - const objs = []; - const parse_options = { 'start': /\b(?:([a-z][a-z0-9.+-]*:\/\/)|xmpp:|mailto:|www\.)/gi }; - try { - URI.withinString(text, (url, start, end) => { - objs.push({url, start, end}) - return url; - } , parse_options); - } catch (error) { - log.debug(error); - return [text]; - } - - let list = [text]; - if (objs.length) { - objs.sort((a, b) => b.start - a.start) - .forEach(url_obj => { - const text = list.shift(); - const url_text = text.slice(url_obj.start, url_obj.end); - list = [ - text.slice(0, url_obj.start), - u.convertUrlToHyperlink(url_text), - text.slice(url_obj.end), - ...list - ]; - }); - } else { - list = [text]; - } - return list; -} - u.httpToGeoUri = function(text, _converse) { const replacement = 'geo:$1,$2'; return text.replace(_converse.api.settings.get("geouri_regex"), replacement);