Fixes review name in pure serialization

This commit is contained in:
Mouse Reeve
2021-03-24 09:31:45 -07:00
parent a0793a15f5
commit bde6ce8525
3 changed files with 20 additions and 8 deletions

View File

@ -304,13 +304,12 @@ class Review(Status):
@property
def pure_name(self):
""" clarify review names for mastodon serialization """
if self.rating:
return 'Review of "{}" ({:d} stars): {}'.format(
self.book.title,
self.rating,
self.name,
)
return 'Review of "{}": {}'.format(self.book.title, self.name)
template = get_template("snippets/generated_status/review_pure_name.html")
return template.render({
"book": self.book,
"rating": int(self.rating),
"name": self.name
}).strip()
@property
def pure_content(self):
@ -332,7 +331,7 @@ class ReviewRating(Review):
@property
def pure_content(self):
template = get_template("snippets/generated_status/rating.html")
return template.render({"book": self.book, "rating": self.rating}).strip()
return template.render({"book": self.book, "rating": int(self.rating)}).strip()
activity_serializer = activitypub.Rating
pure_type = "Note"