- {% url 'settings-profile' as path %} - {% blocktrans %}You can opt-out at any time in your profile settings.{% endblocktrans %} + {% url 'prefs-profile' as path %} + {% blocktrans with path=path %}You can opt-out at any time in your profile settings.{% endblocktrans %}
{# DESCRIPTION #} @@ -137,7 +137,7 @@ {# PREVIEW #}
{% include 'user/shelf/books_header.html' %}
-{{ shelf.name }} @@ -60,7 +60,7 @@
hi
") @@ -157,13 +158,13 @@ class TemplateTags(TestCase): result = markdown.get_markdown("") self.assertEqual(result, "hi
") - def test_get_mentions(self, _): + def test_get_mentions(self, *_): """list of people mentioned""" status = models.Status.objects.create(content="hi", user=self.remote_user) result = status_display.get_mentions(status, self.user) self.assertEqual(result, "@rat@example.com ") - def test_related_status(self, _): + def test_related_status(self, *_): """gets the subclass model for a notification status""" with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay"): status = models.Status.objects.create(content="hi", user=self.user) diff --git a/bookwyrm/tests/views/inbox/test_inbox_announce.py b/bookwyrm/tests/views/inbox/test_inbox_announce.py index 4243dc78e..fdb84d7c5 100644 --- a/bookwyrm/tests/views/inbox/test_inbox_announce.py +++ b/bookwyrm/tests/views/inbox/test_inbox_announce.py @@ -51,7 +51,8 @@ class InboxActivities(TestCase): models.SiteSettings.objects.create() @patch("bookwyrm.activitystreams.ActivityStream.add_status") - def test_boost(self, redis_mock): + @patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores") + def test_boost(self, redis_mock, _): """boost a status""" self.assertEqual(models.Notification.objects.count(), 0) activity = { @@ -81,7 +82,8 @@ class InboxActivities(TestCase): @responses.activate @patch("bookwyrm.activitystreams.ActivityStream.add_status") - def test_boost_remote_status(self, redis_mock): + @patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores") + def test_boost_remote_status(self, redis_mock, _): """boost a status from a remote server""" work = models.Work.objects.create(title="work title") book = models.Edition.objects.create( @@ -153,12 +155,13 @@ class InboxActivities(TestCase): views.inbox.activity_task(activity) self.assertEqual(models.Boost.objects.count(), 0) - def test_unboost(self): + @patch("bookwyrm.activitystreams.ActivityStream.add_status") + @patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores") + def test_unboost(self, *_): """undo a boost""" - with patch("bookwyrm.activitystreams.ActivityStream.add_status"): - boost = models.Boost.objects.create( - boosted_status=self.status, user=self.remote_user - ) + boost = models.Boost.objects.create( + boosted_status=self.status, user=self.remote_user + ) activity = { "type": "Undo", "actor": "hi", @@ -175,11 +178,7 @@ class InboxActivities(TestCase): "published": "Mon, 25 May 2020 19:31:20 GMT", }, } - with patch( - "bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores" - ) as redis_mock: - views.inbox.activity_task(activity) - self.assertTrue(redis_mock.called) + views.inbox.activity_task(activity) self.assertFalse(models.Boost.objects.exists()) def test_unboost_unknown_boost(self): diff --git a/bookwyrm/tests/views/test_interaction.py b/bookwyrm/tests/views/test_interaction.py index 876d6053c..3867f57d5 100644 --- a/bookwyrm/tests/views/test_interaction.py +++ b/bookwyrm/tests/views/test_interaction.py @@ -8,6 +8,7 @@ from bookwyrm import models, views @patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") +@patch("bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores") class InteractionViews(TestCase): """viewing and creating statuses""" @@ -40,7 +41,7 @@ class InteractionViews(TestCase): parent_work=work, ) - def test_favorite(self, _): + def test_favorite(self, *_): """create and broadcast faving a status""" view = views.Favorite.as_view() request = self.factory.post("") @@ -58,7 +59,7 @@ class InteractionViews(TestCase): self.assertEqual(notification.user, self.local_user) self.assertEqual(notification.related_user, self.remote_user) - def test_unfavorite(self, _): + def test_unfavorite(self, *_): """unfav a status""" view = views.Unfavorite.as_view() request = self.factory.post("") @@ -75,7 +76,7 @@ class InteractionViews(TestCase): self.assertEqual(models.Favorite.objects.count(), 0) self.assertEqual(models.Notification.objects.count(), 0) - def test_boost(self, _): + def test_boost(self, *_): """boost a status""" view = views.Boost.as_view() request = self.factory.post("") @@ -97,7 +98,7 @@ class InteractionViews(TestCase): self.assertEqual(notification.related_user, self.remote_user) self.assertEqual(notification.related_status, status) - def test_self_boost(self, _): + def test_self_boost(self, *_): """boost your own status""" view = views.Boost.as_view() request = self.factory.post("") @@ -121,7 +122,7 @@ class InteractionViews(TestCase): self.assertFalse(models.Notification.objects.exists()) - def test_boost_unlisted(self, _): + def test_boost_unlisted(self, *_): """boost a status""" view = views.Boost.as_view() request = self.factory.post("") @@ -136,7 +137,7 @@ class InteractionViews(TestCase): boost = models.Boost.objects.get() self.assertEqual(boost.privacy, "unlisted") - def test_boost_private(self, _): + def test_boost_private(self, *_): """boost a status""" view = views.Boost.as_view() request = self.factory.post("") @@ -149,7 +150,7 @@ class InteractionViews(TestCase): view(request, status.id) self.assertFalse(models.Boost.objects.exists()) - def test_boost_twice(self, _): + def test_boost_twice(self, *_): """boost a status""" view = views.Boost.as_view() request = self.factory.post("") @@ -161,13 +162,17 @@ class InteractionViews(TestCase): view(request, status.id) self.assertEqual(models.Boost.objects.count(), 1) - def test_unboost(self, _): + @patch("bookwyrm.activitystreams.ActivityStream.add_status") + def test_unboost(self, *_): """undo a boost""" view = views.Unboost.as_view() request = self.factory.post("") request.user = self.remote_user - with patch("bookwyrm.activitystreams.ActivityStream.add_status"): - status = models.Status.objects.create(user=self.local_user, content="hi") + status = models.Status.objects.create(user=self.local_user, content="hi") + + with patch( + "bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores" + ): views.Boost.as_view()(request, status.id) self.assertEqual(models.Boost.objects.count(), 1) diff --git a/bookwyrm/views/invite.py b/bookwyrm/views/invite.py index 92f930f45..3b9fd17c5 100644 --- a/bookwyrm/views/invite.py +++ b/bookwyrm/views/invite.py @@ -37,8 +37,12 @@ class ManageInvites(View): PAGE_LENGTH, ) + page = paginated.get_page(request.GET.get("page")) data = { - "invites": paginated.get_page(request.GET.get("page")), + "invites": page, + "page_range": paginated.get_elided_page_range( + page.number, on_each_side=2, on_ends=1 + ), "form": forms.CreateInviteForm(), } return TemplateResponse(request, "settings/manage_invites.html", data) @@ -118,15 +122,16 @@ class ManageInviteRequests(View): reduce(operator.or_, (Q(**f) for f in filters)) ).distinct() - paginated = Paginator( - requests, - PAGE_LENGTH, - ) + paginated = Paginator(requests, PAGE_LENGTH) + page = paginated.get_page(request.GET.get("page")) data = { "ignored": ignored, "count": paginated.count, - "requests": paginated.get_page(request.GET.get("page")), + "requests": page, + "page_range": paginated.get_elided_page_range( + page.number, on_each_side=2, on_ends=1 + ), "sort": sort, } return TemplateResponse(request, "settings/manage_invite_requests.html", data) diff --git a/locale/fr_FR/LC_MESSAGES/django.mo b/locale/fr_FR/LC_MESSAGES/django.mo index fa138f785..3d622ac66 100644 Binary files a/locale/fr_FR/LC_MESSAGES/django.mo and b/locale/fr_FR/LC_MESSAGES/django.mo differ diff --git a/locale/fr_FR/LC_MESSAGES/django.po b/locale/fr_FR/LC_MESSAGES/django.po index 53b4a54af..d29afc1cf 100644 --- a/locale/fr_FR/LC_MESSAGES/django.po +++ b/locale/fr_FR/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-06-07 14:09+0000\n" +"POT-Creation-Date: 2021-06-09 16:46+0000\n" "PO-Revision-Date: 2021-04-05 12:44+0100\n" "Last-Translator: Fabien Basmaison