activitypub: allow is_public?() to work on any type of map representing an AS2 object
This commit is contained in:
		
							parent
							
								
									8e9f1d5587
								
							
						
					
					
						commit
						33b473cc02
					
				
					 1 changed files with 4 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -797,13 +797,11 @@ def fetch_and_contain_remote_object_from_id(id) do
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def is_public?(%Object{data: %{"type" => "Tombstone"}}) do
 | 
			
		||||
    false
 | 
			
		||||
  end
 | 
			
		||||
  def is_public?(%Object{data: %{"type" => "Tombstone"}}), do: false
 | 
			
		||||
  def is_public?(%Activity{data: data}), do: is_public?(data)
 | 
			
		||||
 | 
			
		||||
  def is_public?(activity) do
 | 
			
		||||
    "https://www.w3.org/ns/activitystreams#Public" in (activity.data["to"] ++
 | 
			
		||||
                                                         (activity.data["cc"] || []))
 | 
			
		||||
  def is_public?(data) do
 | 
			
		||||
    "https://www.w3.org/ns/activitystreams#Public" in (data["to"] ++ (data["cc"] || []))
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def visible_for_user?(activity, nil) do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue