Skip to content

Commit 2451d19

Browse files
committed
Fix history/comment tab for RFCs
- Legacy-Id: 1970
1 parent cb7bb69 commit 2451d19

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

ietf/idrfc/views_doc.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,13 @@ def document_main(request, name):
138138
def _get_history(doc, versions):
139139
results = []
140140
if doc.is_id_wrapper:
141-
comments = DocumentComment.objects.filter(document=doc.tracker_id)
141+
comments = DocumentComment.objects.filter(document=doc.tracker_id).exclude(rfc_flag=1)
142142
else:
143-
# note: DocumentComment.rfc_flag is often wrong; avoid it
144-
comments = DocumentComment.objects.filter(document=doc.rfc_number)
143+
comments = DocumentComment.objects.filter(document=doc.rfc_number,rfc_flag=1)
144+
if len(comments) > 0:
145+
# also include rfc_flag=NULL, but only if at least one
146+
# comment with rfc_flag=1 exists (usually NULL means same as 0)
147+
comments = DocumentComment.objects.filter(document=doc.rfc_number).exclude(rfc_flag=0)
145148
for comment in comments.order_by('-date','-time','-id').filter(public_flag=1).select_related('created_by'):
146149
info = {}
147150
info['text'] = comment.comment_text

ietf/idtracker/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ class DocumentComment(models.Model):
655655
(2, 'comment'),
656656
)
657657
document = models.ForeignKey(IDInternal)
658-
# NOTE: This flag is often set incorrectly -- avoid using
658+
# NOTE: This flag is often NULL, which complicates its correct use...
659659
rfc_flag = models.IntegerField(null=True, blank=True)
660660
public_flag = models.IntegerField()
661661
date = models.DateField(db_column='comment_date')

0 commit comments

Comments
 (0)