From: lain Date: Wed, 15 May 2019 15:47:29 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/develop' into conversations-import X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=f168a1cbdc318ffaa2d8bc9fb561eb3dfdfb89d9;p=akkoma Merge remote-tracking branch 'origin/develop' into conversations-import --- f168a1cbdc318ffaa2d8bc9fb561eb3dfdfb89d9 diff --cc lib/pleroma/conversation.ex index 5f6ab902c,0db195988..238c1acf2 --- a/lib/pleroma/conversation.ex +++ b/lib/pleroma/conversation.ex @@@ -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) diff --cc test/web/activity_pub/visibilty_test.exs index ff0e72401,9c03c8be2..e2584f635 --- a/test/web/activity_pub/visibilty_test.exs +++ b/test/web/activity_pub/visibilty_test.exs @@@ -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