From 23cbeab4c1b849defdd9ecc39da7a53d8893c77c Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sun, 20 Dec 2020 12:31:39 -0800 Subject: [PATCH] cleans up remote version of quote status --- bookwyrm/models/status.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bookwyrm/models/status.py b/bookwyrm/models/status.py index 3162c22b..3654e554 100644 --- a/bookwyrm/models/status.py +++ b/bookwyrm/models/status.py @@ -1,5 +1,7 @@ ''' models for storing different kinds of Activities ''' from dataclasses import MISSING +import re + from django.apps import apps from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models @@ -155,7 +157,7 @@ class Comment(Status): @property def pure_content(self): ''' indicate the book in question for mastodon (or w/e) users ''' - return '

%s

(comment on "%s")

' % \ + return '%s

(comment on "%s")

' % \ (self.content, self.book.remote_id, self.book.title) activity_serializer = activitypub.Comment @@ -171,8 +173,10 @@ class Quotation(Status): @property def pure_content(self): ''' indicate the book in question for mastodon (or w/e) users ''' - return '

"%s"
-- "%s"

%s

' % ( - self.quote, + quote = re.sub(r'^

', '

"', self.quote) + quote = re.sub(r'

$', '"

', quote) + return '%s

-- "%s"

%s' % ( + quote, self.book.remote_id, self.book.title, self.content,