mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 03:21:05 +00:00
Substitute “p.” for “page” in page progress serialization
This commit is contained in:
parent
25fd7276ea
commit
1322a0c693
2 changed files with 4 additions and 4 deletions
|
@ -326,7 +326,7 @@ class Comment(BookStatus):
|
|||
f'"{self.book.title}"</a>'
|
||||
)
|
||||
if self.progress_mode == "PG" and progress > 0:
|
||||
citation += f", page {progress}"
|
||||
citation += f", p. {progress}"
|
||||
return f"{self.content}<p>({citation})</p>"
|
||||
|
||||
activity_serializer = activitypub.Comment
|
||||
|
@ -358,7 +358,7 @@ class Quotation(BookStatus):
|
|||
quote = re.sub(r"</p>$", '"</p>', quote)
|
||||
citation = f'-- <a href="{self.book.remote_id}">"{self.book.title}"</a>'
|
||||
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} <p>{citation}</p>{self.content}"
|
||||
|
||||
activity_serializer = activitypub.Quotation
|
||||
|
|
|
@ -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<p>(comment on <a href="{self.book.remote_id}">"Test Edition"</a>)</p>',
|
||||
f'test content<p>(comment on <a href="{self.book.remote_id}">"Test Edition"</a>, p. 27)</p>',
|
||||
)
|
||||
self.assertEqual(activity["attachment"][0]["type"], "Document")
|
||||
# self.assertTrue(
|
||||
|
|
Loading…
Reference in a new issue