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!(/\[u\](.+?)\[\/u\]/i, '<u>\1</u>')
|
||||||
str.gsub!(/\[tn\](.+?)\[\/tn\]/i, '<p class="tn">\1</p>')
|
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_links(str)
|
||||||
str = parse_aliased_wiki_links(str)
|
str = parse_aliased_wiki_links(str)
|
||||||
str = parse_wiki_links(str)
|
str = parse_wiki_links(str)
|
||||||
@@ -54,7 +54,9 @@ class DText
|
|||||||
str
|
str
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.parse_mentions(str)
|
def self.parse_mentions(str, options = {})
|
||||||
|
return if options[:disable_mentions]
|
||||||
|
|
||||||
str.gsub!(MENTION_REGEXP) do |name|
|
str.gsub!(MENTION_REGEXP) do |name|
|
||||||
next name unless name =~ /[a-z0-9]/i
|
next name unless name =~ /[a-z0-9]/i
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<section id="original-artist-commentary">
|
<section id="original-artist-commentary">
|
||||||
<h3><%= artist_commentary.original_title %></h3>
|
<h3><%= artist_commentary.original_title %></h3>
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<%= format_text(artist_commentary.original_description, :ragel => true) %>
|
<%= format_text(artist_commentary.original_description, :ragel => true, :disable_mentions => true) %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -31,9 +31,9 @@
|
|||||||
</h3>
|
</h3>
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<% if artist_commentary.translated_description.present? %>
|
<% 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 %>
|
<% 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 %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<% if @artist.notes.present? && @artist.visible? %>
|
<% if @artist.notes.present? && @artist.visible? %>
|
||||||
<div class="prose">
|
<div class="prose">
|
||||||
<%= format_text(@artist.notes, :ragel => true) %>
|
<%= format_text(@artist.notes, :ragel => true, :disable_mentions => true) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
<p><%= link_to "View wiki page", @artist.wiki_page %></p>
|
||||||
|
|||||||
Reference in New Issue
Block a user