From 2ab9e036a5d75dc0d4926e7137b381884e2e2108 Mon Sep 17 00:00:00 2001 From: Andrew Date: Sun, 17 Dec 2017 22:33:03 -0800 Subject: [PATCH] Hotlink twitter mentions Differentiate twitter mentions from normal mentions --- app/lib/formatter.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index e6f5d7a63..09f2d1e9e 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -265,8 +265,9 @@ class Formatter def link_to_mention(entity, linkable_accounts) acct = entity[:screen_name] + username, domain = acct.split('@') - return link_to_account(acct) unless linkable_accounts + return link_to_account(acct) unless linkable_accounts and domain != "twitter.com" account = linkable_accounts.find { |item| TagManager.instance.same_acct?(item.acct, acct) } account ? mention_html(account) : "@#{encode(acct)}" @@ -275,6 +276,10 @@ class Formatter def link_to_account(acct) username, domain = acct.split('@') + if domain == "twitter.com" + return mention_twitter_html(username) + end + domain = nil if TagManager.instance.local_domain?(domain) account = EntityCache.instance.mention(username, domain) @@ -302,4 +307,8 @@ class Formatter def mention_html(account) "@#{encode(account.username)}" end + + def mention_twitter_html(username) + "@#{username}@twitter.com" + end end