From 8b1cdca6a2d9ea974164bedb5a2bd64bfd99488e Mon Sep 17 00:00:00 2001 From: octavioamu Date: Mon, 17 Feb 2020 10:35:48 -0300 Subject: [PATCH] fix regex for mentions hash and links --- app/assets/v2/js/activity.js | 6 +++--- app/retail/templates/shared/activity.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/v2/js/activity.js b/app/assets/v2/js/activity.js index 3ed06fe5e66..2f337bdd5c9 100644 --- a/app/assets/v2/js/activity.js +++ b/app/assets/v2/js/activity.js @@ -3,14 +3,14 @@ $(document).ready(function() { var linkify = function(new_text) { - new_text = new_text.replace(/ #(\S*)/g, ' #$1'); - new_text = new_text.replace(/ @(\S*)/g, ' @$1'); + new_text = new_text.replace(/(?#$1'); + new_text = new_text.replace(/\B@(\w*)/g, ' @$1'); return new_text; }; // inserts links into the text where there are URLS detected function urlify(text) { - var urlRegex = /(https?:\/\/[^\s]+)/g; + var urlRegex = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g; return text.replace(urlRegex, function(url) { return '' + url + ''; diff --git a/app/retail/templates/shared/activity.html b/app/retail/templates/shared/activity.html index d65fd778587..373fae24c40 100644 --- a/app/retail/templates/shared/activity.html +++ b/app/retail/templates/shared/activity.html @@ -20,7 +20,7 @@ {% if row.activity_type == 'new_bounty' %}
New Bounty - +
{% endif %}