Fix #5435 - Bad comment links cause server error

This patch addresses an issue where a server error is caused by
entering a non-existent comment ID in a media URL.
This commit is contained in:
Andrew Browning 2016-03-02 12:29:33 -05:00
parent 161bc6b2c1
commit 289826dc46

View File

@ -71,6 +71,11 @@ def mark_notification_seen(notification):
def mark_comment_notification_seen(comment_id, user): def mark_comment_notification_seen(comment_id, user):
comment = Comment.query.get(comment_id) comment = Comment.query.get(comment_id)
# If there is no comment, there is no notification
if comment == None:
return
comment_gmr = GenericModelReference.query.filter_by( comment_gmr = GenericModelReference.query.filter_by(
obj_pk=comment.id, obj_pk=comment.id,
model_type=comment.__tablename__ model_type=comment.__tablename__