Remove redundant return in IntentsController (#29099)
				
					
				
			This commit is contained in:
		
							parent
							
								
									e8cc98977d
								
							
						
					
					
						commit
						0877f6fda4
					
				@ -1,27 +1,26 @@
 | 
				
			|||||||
# frozen_string_literal: true
 | 
					# frozen_string_literal: true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class IntentsController < ApplicationController
 | 
					class IntentsController < ApplicationController
 | 
				
			||||||
  before_action :check_uri
 | 
					  EXPECTED_SCHEME = 'web+mastodon'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  before_action :handle_invalid_uri, unless: :valid_uri?
 | 
				
			||||||
  rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri
 | 
					  rescue_from Addressable::URI::InvalidURIError, with: :handle_invalid_uri
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def show
 | 
					  def show
 | 
				
			||||||
    if uri.scheme == 'web+mastodon'
 | 
					 | 
				
			||||||
    case uri.host
 | 
					    case uri.host
 | 
				
			||||||
    when 'follow'
 | 
					    when 'follow'
 | 
				
			||||||
        return redirect_to authorize_interaction_path(uri: uri.query_values['uri'].delete_prefix('acct:'))
 | 
					      redirect_to authorize_interaction_path(uri: uri.query_values['uri'].delete_prefix('acct:'))
 | 
				
			||||||
    when 'share'
 | 
					    when 'share'
 | 
				
			||||||
        return redirect_to share_path(text: uri.query_values['text'])
 | 
					      redirect_to share_path(text: uri.query_values['text'])
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					      handle_invalid_uri
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    not_found
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  private
 | 
					  private
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def check_uri
 | 
					  def valid_uri?
 | 
				
			||||||
    not_found if uri.blank?
 | 
					    uri.present? && uri.scheme == EXPECTED_SCHEME
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def handle_invalid_uri
 | 
					  def handle_invalid_uri
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user