Merge remote-tracking branch 'origin/develop' into conversations-import
authorlain <lain@soykaf.club>
Wed, 15 May 2019 15:47:29 +0000 (17:47 +0200)
committerlain <lain@soykaf.club>
Wed, 15 May 2019 15:47:29 +0000 (17:47 +0200)
1  2 
lib/pleroma/conversation.ex
lib/pleroma/web/activity_pub/activity_pub.ex
lib/pleroma/web/activity_pub/visibility.ex
test/conversation_test.exs
test/web/activity_pub/visibilty_test.exs

index 5f6ab902c1ebb1bf4d2ba6abe0dc9f45b82ff632,0db1959889ab08cb568f64646b9c48c79969bf24..238c1acf201dda42301b7cb8c4332fcb80e59ea0
@@@ -45,10 -45,10 +45,10 @@@ defmodule Pleroma.Conversation d
    2. Create a participation for all the people involved who don't have one already
    3. Bump all relevant participations to 'unread'
    """
 -  def create_or_bump_for(activity) do
 +  def create_or_bump_for(activity, opts \\ []) do
      with true <- Pleroma.Web.ActivityPub.Visibility.is_direct?(activity),
-          object <- Pleroma.Object.normalize(activity),
           "Create" <- activity.data["type"],
+          object <- Pleroma.Object.normalize(activity),
           "Note" <- object.data["type"],
           ap_id when is_binary(ap_id) and byte_size(ap_id) > 0 <- object.data["context"] do
        {:ok, conversation} = create_for_ap_id(ap_id)
Simple merge
index ff0e724014ed47c62edfd898bc83991e5049891b,9c03c8be2ecf0c43ae89a0856282bda591cfe571..e2584f635f881e15d8c12a2cd59c7cadb76f85f9
@@@ -96,13 -96,15 +96,25 @@@ defmodule Pleroma.Web.ActivityPub.Visib
      refute Visibility.visible_for_user?(direct, unrelated)
    end
  
 +  test "doesn't die when the user doesn't exist",
 +       %{
 +         direct: direct,
 +         user: user
 +       } do
 +    Repo.delete(user)
 +    Cachex.clear(:user_cache)
 +    refute Visibility.is_private?(direct)
 +  end
++
+   test "get_visibility", %{
+     public: public,
+     private: private,
+     direct: direct,
+     unlisted: unlisted
+   } do
+     assert Visibility.get_visibility(public) == "public"
+     assert Visibility.get_visibility(private) == "private"
+     assert Visibility.get_visibility(direct) == "direct"
+     assert Visibility.get_visibility(unlisted) == "unlisted"
+   end
  end