fixes #2654: @mentions shouldn't link to Danbooru users in artist commentaries
This commit is contained in:
@@ -45,7 +45,7 @@ class DText
|
||||
str.gsub!(/\[u\](.+?)\[\/u\]/i, '<u>\1</u>')
|
||||
str.gsub!(/\[tn\](.+?)\[\/tn\]/i, '<p class="tn">\1</p>')
|
||||
|
||||
str = parse_mentions(str)
|
||||
str = parse_mentions(str, options)
|
||||
str = parse_links(str)
|
||||
str = parse_aliased_wiki_links(str)
|
||||
str = parse_wiki_links(str)
|
||||
@@ -54,7 +54,9 @@ class DText
|
||||
str
|
||||
end
|
||||
|
||||
def self.parse_mentions(str)
|
||||
def self.parse_mentions(str, options = {})
|
||||
return if options[:disable_mentions]
|
||||
|
||||
str.gsub!(MENTION_REGEXP) do |name|
|
||||
next name unless name =~ /[a-z0-9]/i
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<section id="original-artist-commentary">
|
||||
<h3><%= artist_commentary.original_title %></h3>
|
||||
<div class="prose">
|
||||
<%= format_text(artist_commentary.original_description, :ragel => true) %>
|
||||
<%= format_text(artist_commentary.original_description, :ragel => true, :disable_mentions => true) %>
|
||||
</div>
|
||||
</section>
|
||||
<% end %>
|
||||
@@ -31,9 +31,9 @@
|
||||
</h3>
|
||||
<div class="prose">
|
||||
<% if artist_commentary.translated_description.present? %>
|
||||
<%= format_text(artist_commentary.translated_description, :ragel => true) %>
|
||||
<%= format_text(artist_commentary.translated_description, :ragel => true, :disable_mentions => true) %>
|
||||
<% else %>
|
||||
<span class="disabled"><%= format_text(artist_commentary.original_description, :ragel => true) %></span>
|
||||
<span class="disabled"><%= format_text(artist_commentary.original_description, :ragel => true, :disable_mentions => true) %></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<% if @artist.notes.present? && @artist.visible? %>
|
||||
<div class="prose">
|
||||
<%= format_text(@artist.notes, :ragel => true) %>
|
||||
<%= format_text(@artist.notes, :ragel => true, :disable_mentions => true) %>
|
||||
</div>
|
||||
|
||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||
|
||||
Reference in New Issue
Block a user