From 1322a0c6939f364a023aa0df1c01e9685d4c31f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adeodato=20Sim=C3=B3?= Date: Sun, 17 Sep 2023 15:05:34 -0300 Subject: [PATCH] =?UTF-8?q?Substitute=20=E2=80=9Cp.=E2=80=9D=20for=20?= =?UTF-8?q?=E2=80=9Cpage=E2=80=9D=20in=20page=20progress=20serialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bookwyrm/models/status.py | 4 ++-- bookwyrm/tests/models/test_status_model.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 8c98028a0..1040ace8f 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -326,7 +326,7 @@ class Comment(BookStatus): f'"{self.book.title}"' ) if self.progress_mode == "PG" and progress > 0: - citation += f", page {progress}" + citation += f", p. {progress}" return f"{self.content}

({citation})

" activity_serializer = activitypub.Comment @@ -358,7 +358,7 @@ class Quotation(BookStatus): quote = re.sub(r"

$", '"

', quote) citation = f'-- "{self.book.title}"' if self.position_mode == "PG" and self.position and (self.position > 0): - citation += f", page {self.position}" + citation += f", p. {self.position}" return f"{quote}

{citation}

{self.content}" activity_serializer = activitypub.Quotation diff --git a/bookwyrm/tests/models/test_status_model.py b/bookwyrm/tests/models/test_status_model.py index 72aa0ca6c..d41b80575 100644 --- a/bookwyrm/tests/models/test_status_model.py +++ b/bookwyrm/tests/models/test_status_model.py @@ -249,14 +249,14 @@ class Status(TestCase): def test_comment_to_pure_activity(self, *_): """subclass of the base model version with a "pure" serializer""" status = models.Comment.objects.create( - content="test content", user=self.local_user, book=self.book + content="test content", user=self.local_user, book=self.book, progress=27 ) activity = status.to_activity(pure=True) self.assertEqual(activity["id"], status.remote_id) self.assertEqual(activity["type"], "Note") self.assertEqual( activity["content"], - f'test content

(comment on "Test Edition")

', + f'test content

(comment on "Test Edition", p. 27)

', ) self.assertEqual(activity["attachment"][0]["type"], "Document") # self.assertTrue(