File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ def call(status)
1717
1818 return if @url . nil? || @status . preview_cards . any?
1919
20- @url = @url . to_s
20+ @mentions = status . mentions
21+ @url = @url . to_s
2122
2223 RedisLock . acquire ( lock_options ) do |lock |
2324 if lock . acquired?
@@ -81,9 +82,16 @@ def bad_url?(uri)
8182 uri . host . blank? || TagManager . instance . local_url? ( uri . to_s ) || !%w( http https ) . include? ( uri . scheme )
8283 end
8384
85+ def mention_link? ( a )
86+ return false if @mentions . nil?
87+ @mentions . any? do |mention |
88+ a [ 'href' ] == TagManager . instance . url_for ( mention . target )
89+ end
90+ end
91+
8492 def skip_link? ( a )
8593 # Avoid links for hashtags and mentions (microformats)
86- a [ 'rel' ] &.include? ( 'tag' ) || a [ 'class' ] &.include? ( 'u-url' )
94+ a [ 'rel' ] &.include? ( 'tag' ) || a [ 'class' ] &.include? ( 'u-url' ) || mention_link? ( a )
8795 end
8896
8997 def attempt_oembed
You can’t perform that action at this time.
0 commit comments