Simplify the way the embed view is created (#1590)
* Add coverage for embedded status view * Refactor embed view to eliminate @external_links variable
This commit is contained in:
		
							parent
							
								
									b352a8e5d4
								
							
						
					
					
						commit
						dd1ae3b109
					
				
					 5 changed files with 25 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
.detailed-status.light
 | 
			
		||||
  = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: @external_links ? '_blank' : nil, rel: 'noopener' do
 | 
			
		||||
  = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
 | 
			
		||||
    %div
 | 
			
		||||
      %div.avatar
 | 
			
		||||
        = image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@
 | 
			
		|||
 | 
			
		||||
  %div.detailed-status__meta
 | 
			
		||||
    %data.dt-published{ value: status.created_at.to_time.iso8601 }
 | 
			
		||||
    = link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: @external_links ? '_blank' : nil, rel: 'noopener' do
 | 
			
		||||
    = link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do
 | 
			
		||||
      %span= l(status.created_at)
 | 
			
		||||
    ·
 | 
			
		||||
    - if status.application
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,10 +1,10 @@
 | 
			
		|||
.status.light
 | 
			
		||||
  .status__header
 | 
			
		||||
    .status__meta
 | 
			
		||||
      = link_to time_ago_in_words(status.created_at), TagManager.instance.url_for(status), class: 'status__relative-time u-url u-uid', title: l(status.created_at), target: @external_links ? '_blank' : nil, rel: 'noopener'
 | 
			
		||||
      = link_to time_ago_in_words(status.created_at), TagManager.instance.url_for(status), class: 'status__relative-time u-url u-uid', title: l(status.created_at), target: stream_link_target, rel: 'noopener'
 | 
			
		||||
      %data.dt-published{ value: status.created_at.to_time.iso8601 }
 | 
			
		||||
 | 
			
		||||
    = link_to TagManager.instance.url_for(status.account), class: 'status__display-name p-author h-card', target: @external_links ? '_blank' : nil, rel: 'noopener' do
 | 
			
		||||
    = link_to TagManager.instance.url_for(status.account), class: 'status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
 | 
			
		||||
      .status__avatar
 | 
			
		||||
        %div
 | 
			
		||||
          = image_tag status.account.avatar(:original), width: 48, height: 48, alt: '', class: 'u-photo'
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue