From dd1ae3b10924ca239daa17ce2fe739f790e6f96d Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 12 Apr 2017 10:12:42 -0400 Subject: Simplify the way the embed view is created (#1590) * Add coverage for embedded status view * Refactor embed view to eliminate @external_links variable --- app/helpers/stream_entries_helper.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/helpers/stream_entries_helper.rb') diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb index d5cc004b0..59aac7841 100644 --- a/app/helpers/stream_entries_helper.rb +++ b/app/helpers/stream_entries_helper.rb @@ -5,8 +5,12 @@ module StreamEntriesHelper account.display_name.blank? ? account.username : account.display_name end + def stream_link_target + embedded_view? ? '_blank' : nil + end + def acct(account) - "@#{account.acct}#{@external_links && account.local? ? "@#{Rails.configuration.x.local_domain}" : ''}" + "@#{account.acct}#{embedded_view? && account.local? ? "@#{Rails.configuration.x.local_domain}" : ''}" end def entry_classes(status, is_predecessor, is_successor, include_threads) @@ -30,4 +34,10 @@ module StreamEntriesHelper rtl_size / ltr_size > 0.3 end + + private + + def embedded_view? + params[:controller] == 'stream_entries' && params[:action] == 'embed' + end end -- cgit