diff options
author | Jessica Tallon <tsyesika@tsyesika.se> | 2016-03-01 11:58:38 +0000 |
---|---|---|
committer | Jessica Tallon <tsyesika@tsyesika.se> | 2016-03-01 12:04:08 +0000 |
commit | 161bc6b2c18f2d20eb759725b2df7fc7ac4a2728 (patch) | |
tree | 7e10e43dcc6fcd85e8f9e366f2e10dd0152745bc /mediagoblin/db/models.py | |
parent | 1db8690fe9dc625bc648e04493d075cad76689cc (diff) | |
download | mediagoblin-161bc6b2c18f2d20eb759725b2df7fc7ac4a2728.tar.lz mediagoblin-161bc6b2c18f2d20eb759725b2df7fc7ac4a2728.tar.xz mediagoblin-161bc6b2c18f2d20eb759725b2df7fc7ac4a2728.zip |
Fix #5376 - Ensure links have correct ID
This ensures that links to comments have the correct ID (the
ID of the Comment object) as well as fixing deletion on reports
and fixing a few other little things. I hope this fixes the #5376
issue, though cannot reproduce so unable to confirm.
Diffstat (limited to 'mediagoblin/db/models.py')
-rw-r--r-- | mediagoblin/db/models.py | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/mediagoblin/db/models.py b/mediagoblin/db/models.py index 3f36f227..5393f679 100644 --- a/mediagoblin/db/models.py +++ b/mediagoblin/db/models.py @@ -609,7 +609,7 @@ class MediaEntry(Base, MediaEntryMixin, CommentingMixin): else: query = query.order_by(Comment.added.desc()) - return FakeCursor(query, lambda c:c.comment()) + return query def url_to_prev(self, urlgen): """get the next 'newer' entry by this user""" @@ -778,7 +778,7 @@ class MediaEntry(Base, MediaEntryMixin, CommentingMixin): if show_comments: comments = [ - comment.serialize(request) for comment in self.get_comments()] + l.comment().serialize(request) for l in self.get_comments()] total = len(comments) context["replies"] = { "totalItems": total, @@ -1008,17 +1008,6 @@ class TextComment(Base, TextCommentMixin, CommentingMixin): cascade="all, delete-orphan")) deletion_mode = Base.SOFT_DELETE - def soft_delete(self, *args, **kwargs): - # Find the GMR for this model. - gmr = GenericModelReference.query.filter_by( - obj_pk=self.id, - model_type=self.__tablename__ - ).first() - - # Delete the Comment object for this comment - Comment.query.filter_by(comment_id=gmr.id).delete() - return super(TextComment, self).soft_delete(*args, **kwargs) - def serialize(self, request): """ Unserialize to python dictionary for API """ target = self.get_reply_to() |