forked from mirrors/bookwyrm
Fixes wording in comments
This commit is contained in:
parent
5e932711f9
commit
2640c26bb1
3 changed files with 10 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
||||||
""" access the activity streams stored in redis """
|
""" access the list streams stored in redis """
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import signals, Count, Q
|
from django.db.models import signals, Count, Q
|
||||||
|
@ -25,8 +25,8 @@ class ListsStream(RedisStore):
|
||||||
self.add_object_to_related_stores(book_list)
|
self.add_object_to_related_stores(book_list)
|
||||||
|
|
||||||
def add_user_lists(self, viewer, user):
|
def add_user_lists(self, viewer, user):
|
||||||
"""add a user's listes to another user's feed"""
|
"""add a user's lists to another user's feed"""
|
||||||
# only add the listes that the viewer should be able to see
|
# only add the lists that the viewer should be able to see
|
||||||
lists = models.List.filter(user=user).privacy_filter(viewer)
|
lists = models.List.filter(user=user).privacy_filter(viewer)
|
||||||
self.bulk_add_objects_to_store(lists, self.stream_id(viewer))
|
self.bulk_add_objects_to_store(lists, self.stream_id(viewer))
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class ListsStream(RedisStore):
|
||||||
@receiver(signals.post_save, sender=models.List)
|
@receiver(signals.post_save, sender=models.List)
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def add_list_on_create(sender, instance, created, *args, **kwargs):
|
def add_list_on_create(sender, instance, created, *args, **kwargs):
|
||||||
"""add newly created lists to activity feeds"""
|
"""add newly created lists streamsstreams"""
|
||||||
if not created:
|
if not created:
|
||||||
return
|
return
|
||||||
# when creating new things, gotta wait on the transaction
|
# when creating new things, gotta wait on the transaction
|
||||||
|
@ -120,7 +120,7 @@ def add_list_on_create(sender, instance, created, *args, **kwargs):
|
||||||
@receiver(signals.pre_delete, sender=models.List)
|
@receiver(signals.pre_delete, sender=models.List)
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def remove_list_on_delete(sender, instance, *args, **kwargs):
|
def remove_list_on_delete(sender, instance, *args, **kwargs):
|
||||||
"""add newly created lists to activity feeds"""
|
"""remove deleted lists to streams"""
|
||||||
remove_list_task.delay(instance.id)
|
remove_list_task.delay(instance.id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ def populate_lists_on_account_create(sender, instance, created, *args, **kwargs)
|
||||||
# ---- TASKS
|
# ---- TASKS
|
||||||
@app.task(queue=MEDIUM)
|
@app.task(queue=MEDIUM)
|
||||||
def populate_lists_task(user_id):
|
def populate_lists_task(user_id):
|
||||||
"""background task for populating an empty activitystream"""
|
"""background task for populating an empty list stream"""
|
||||||
user = models.User.objects.get(id=user_id)
|
user = models.User.objects.get(id=user_id)
|
||||||
ListsStream().populate_streams(user)
|
ListsStream().populate_streams(user)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
""" Re-create user streams """
|
""" Re-create list streams """
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from bookwyrm import lists_stream, models
|
from bookwyrm import lists_stream, models
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@ def populate_lists_streams():
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
"""start all over with user streams"""
|
"""start all over with lists streams"""
|
||||||
|
|
||||||
help = "Populate streams for all users"
|
help = "Populate list streams for all users"
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ListsStreamSignals(TestCase):
|
||||||
user=self.remote_user, name="hi", privacy="public"
|
user=self.remote_user, name="hi", privacy="public"
|
||||||
)
|
)
|
||||||
with patch("bookwyrm.lists_stream.add_list_task.delay") as mock:
|
with patch("bookwyrm.lists_stream.add_list_task.delay") as mock:
|
||||||
lists_stream.add_list_on_create_command(book_list)
|
lists_stream.add_list_on_create(models.List, book_list, True)
|
||||||
self.assertEqual(mock.call_count, 1)
|
self.assertEqual(mock.call_count, 1)
|
||||||
args = mock.call_args[0]
|
args = mock.call_args[0]
|
||||||
self.assertEqual(args[0], book_list.id)
|
self.assertEqual(args[0], book_list.id)
|
||||||
|
|
Loading…
Reference in a new issue