users: re-enable username '@' linking in user profiles
This commit is contained in:
parent
e14d9194c3
commit
3d54a8ea83
|
@ -346,9 +346,7 @@ class User < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def linkified_about
|
def linkified_about
|
||||||
# most users are probably mentioning "@username" to mean a twitter url, not
|
Markdowner.to_html(self.about)
|
||||||
# a link to a profile on this site
|
|
||||||
Markdowner.to_html(self.about, { :disable_profile_links => true })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def most_common_story_tag
|
def most_common_story_tag
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
class Markdowner
|
class Markdowner
|
||||||
# opts[:allow_images] allows <img> tags
|
# opts[:allow_images] allows <img> tags
|
||||||
# opts[:disable_profile_links] disables @username -> /u/username links
|
|
||||||
|
|
||||||
def self.to_html(text, opts = {})
|
def self.to_html(text, opts = {})
|
||||||
if text.blank?
|
if text.blank?
|
||||||
|
@ -10,9 +9,7 @@ class Markdowner
|
||||||
exts = [:tagfilter, :autolink, :strikethrough]
|
exts = [:tagfilter, :autolink, :strikethrough]
|
||||||
root = CommonMarker.render_doc(text.to_s, [:SMART], exts)
|
root = CommonMarker.render_doc(text.to_s, [:SMART], exts)
|
||||||
|
|
||||||
unless opts[:disable_profile_links]
|
walk_text_nodes(root){|n| postprocess_text_node(n) }
|
||||||
walk_text_nodes(root) {|n| postprocess_text_node(n)}
|
|
||||||
end
|
|
||||||
|
|
||||||
ng = Nokogiri::HTML(root.to_html([:SAFE], exts))
|
ng = Nokogiri::HTML(root.to_html([:SAFE], exts))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue