Browse Source

users: re-enable username '@' linking in user profiles

master
Carl Chenet 3 years ago
parent
commit
3d54a8ea83
2 changed files with 2 additions and 7 deletions
  1. +1
    -3
      app/models/user.rb
  2. +1
    -4
      extras/markdowner.rb

+ 1
- 3
app/models/user.rb View File

@@ -346,9 +346,7 @@ class User < ActiveRecord::Base
end

def linkified_about
# most users are probably mentioning "@username" to mean a twitter url, not
# a link to a profile on this site
Markdowner.to_html(self.about, { :disable_profile_links => true })
Markdowner.to_html(self.about)
end

def most_common_story_tag


+ 1
- 4
extras/markdowner.rb View File

@@ -1,6 +1,5 @@
class Markdowner
# opts[:allow_images] allows <img> tags
# opts[:disable_profile_links] disables @username -> /u/username links

def self.to_html(text, opts = {})
if text.blank?
@@ -10,9 +9,7 @@ class Markdowner
exts = [:tagfilter, :autolink, :strikethrough]
root = CommonMarker.render_doc(text.to_s, [:SMART], exts)

unless opts[:disable_profile_links]
walk_text_nodes(root) {|n| postprocess_text_node(n)}
end
walk_text_nodes(root){|n| postprocess_text_node(n) }

ng = Nokogiri::HTML(root.to_html([:SAFE], exts))



Loading…
Cancel
Save