Skip to content

Commit

Permalink
fix regex for mentions hash and links
Browse files Browse the repository at this point in the history
  • Loading branch information
octavioamu committed Feb 18, 2020
1 parent a7e85b2 commit e489da3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/assets/v2/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
$(document).ready(function() {

var linkify = function(new_text) {
new_text = new_text.replace(/ #(\S*)/g, ' <a href="/?tab=search-$1">#$1</a>');
new_text = new_text.replace(/ @(\S*)/g, ' <a href="/profile/$1">@$1</a>');
new_text = new_text.replace(/(?<!\S)#(\w*)/g, ' <a href="/?tab=search-$1">#$1</a>');
new_text = new_text.replace(/\B@(\w*)/g, ' <a href="/profile/$1">@$1</a>');
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 '<a target=blank rel=nofollow href="' + url + '">' + url + '</a>';
Expand Down
2 changes: 1 addition & 1 deletion app/retail/templates/shared/activity.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{% if row.activity_type == 'new_bounty' %}
<div class="align-items-baseline d-flex font-weight-bold justify-content-between mb-2 mt-n3">
<b>New Bounty</b>
<i class="fas fa-2x fa-sparkles" style="right: 0.2em; color: #3e00ff;"></i>
<i class="fad fa-2x fa-sparkles" style="right: 0.2em; color: #3e00ff;"></i>
</div>
{% endif %}
<div class="activity_main row">
Expand Down

0 comments on commit e489da3

Please sign in to comment.