From 161bc6b2c18f2d20eb759725b2df7fc7ac4a2728 Mon Sep 17 00:00:00 2001 From: Jessica Tallon Date: Tue, 1 Mar 2016 11:58:38 +0000 Subject: 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. --- mediagoblin/db/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'mediagoblin/db/base.py') diff --git a/mediagoblin/db/base.py b/mediagoblin/db/base.py index 0f17a3a8..c59b0ebf 100644 --- a/mediagoblin/db/base.py +++ b/mediagoblin/db/base.py @@ -96,7 +96,7 @@ class GMGTableBase(object): # cause issues if it isn't. See #5382. # Import here to prevent cyclic imports. from mediagoblin.db.models import CollectionItem, GenericModelReference, \ - Report, Notification + Report, Notification, Comment # Some of the models don't have an "id" field which means they can't be # used with GMR, these models won't be in collections because they @@ -123,6 +123,12 @@ class GMGTableBase(object): ) notifications.delete() + # Delete this as a comment + comments = Comment.query.filter_by( + comment_id=gmr.id + ) + comments.delete() + # Set None on reports found reports = Report.query.filter_by( object_id=gmr.id -- cgit v1.2.3