Merge pull request #803 from mouse-reeve/stream-error

Fixes error adding unlisted statuses
This commit is contained in:
Mouse Reeve 2021-03-26 18:38:00 -07:00 committed by GitHub
commit 492ba3773f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View file

@ -88,7 +88,7 @@ class ActivityStream(ABC):
""" given a status, what users should see it """
# direct messages don't appeard in feeds, direct comments/reviews/etc do
if status.privacy == "direct" and status.status_type == "Note":
return None
return []
# everybody who could plausibly see this status
audience = models.User.objects.filter(
@ -150,7 +150,7 @@ class LocalStream(ActivityStream):
def stream_users(self, status):
# this stream wants no part in non-public statuses
if status.privacy != "public" or not status.user.local:
return None
return []
return super().stream_users(status)
def stream_statuses(self, user):
@ -170,7 +170,7 @@ class FederatedStream(ActivityStream):
def stream_users(self, status):
# this stream wants no part in non-public statuses
if status.privacy != "public":
return None
return []
return super().stream_users(status)
def stream_statuses(self, user):

View file

@ -67,7 +67,7 @@ class Activitystreams(TestCase):
)
status.mention_users.add(self.local_user)
users = self.test_stream.stream_users(status)
self.assertIsNone(users)
self.assertEqual(users, [])
status = models.Comment.objects.create(
user=self.remote_user,
@ -167,7 +167,7 @@ class Activitystreams(TestCase):
user=self.remote_user, content="hi", privacy="public"
)
users = activitystreams.LocalStream().stream_users(status)
self.assertIsNone(users)
self.assertEqual(users, [])
def test_localstream_stream_users_local_status(self, *_):
""" get a list of users that should see a status """
@ -184,7 +184,7 @@ class Activitystreams(TestCase):
user=self.local_user, content="hi", privacy="unlisted"
)
users = activitystreams.LocalStream().stream_users(status)
self.assertIsNone(users)
self.assertEqual(users, [])
def test_federatedstream_stream_users(self, *_):
""" get a list of users that should see a status """
@ -201,4 +201,4 @@ class Activitystreams(TestCase):
user=self.remote_user, content="hi", privacy="unlisted"
)
users = activitystreams.FederatedStream().stream_users(status)
self.assertIsNone(users)
self.assertEqual(users, [])