Unescaping incorrectly escaped and linkified comments and replies.

This commit is contained in:
Samuel Clay 2012-07-23 23:23:34 -07:00
parent fb6e3218ba
commit 72655a5116
4 changed files with 7 additions and 6 deletions

View file

@ -135,7 +135,7 @@
<div class="NB-story-comment-date">{{ comment.shared_date }} ago</div>
</div>
<div class="NB-story-comment-content">
{{ comment.comments|linebreaksbr }}
{{ comment.comments|linebreaksbr|safe }}
</div>
{% if comment.replies %}
<div class="NB-story-comment-replies">
@ -146,7 +146,7 @@
</a>
<a href="{{ reply.user.feed_link }}" class="NB-story-comment-username NB-story-comment-reply-username">{{ reply.user.username }}</a>
<div class="NB-story-comment-date NB-story-comment-reply-date">{{ reply.publish_date }} ago</div>
<div class="NB-story-comment-reply-content">{{ reply.comments }}</div>
<div class="NB-story-comment-reply-content">{{ reply.comments|safe }}</div>
</div>
{% endfor %}
</div>

View file

@ -69,7 +69,7 @@
</div>
{% if activity.content %}
<div class="NB-interaction-content">
"<span class="NB-interaction-sharedstory-content NB-splash-link">{{ activity.content|truncatewords:16 }}</span>"
"<span class="NB-interaction-sharedstory-content NB-splash-link">{{ activity.content|safe|truncatewords:16 }}</span>"
</div>
{% endif %}
{% endif %}

View file

@ -19,7 +19,7 @@
</div>
</div>
<div class="NB-story-comment-content">
{{ comment.comments|linebreaksbr }}
{{ comment.comments|linebreaksbr|safe }}
</div>
{% if comment.replies %}
<div class="NB-story-comment-replies">
@ -30,7 +30,7 @@
</a>
<a href="{{ reply.user.feed_link }}" class="NB-story-comment-username NB-story-comment-reply-username">{{ reply.user.username }}</a>
<div class="NB-story-comment-date NB-story-comment-reply-date">{{ reply.publish_date }} ago</div>
<div class="NB-story-comment-reply-content">{{ reply.comments }}</div>
<div class="NB-story-comment-reply-content">{{ reply.comments|safe }}</div>
</div>
{% endfor %}
</div>

View file

@ -5,6 +5,7 @@ from django.utils.dateformat import DateFormat
from django.utils.html import strip_tags as strip_tags_django
from django.conf import settings
from utils.tornado_escape import linkify as linkify_tornado
from utils.tornado_escape import xhtml_unescape as xhtml_unescape_tornado
def story_score(story, bottom_delta=None):
# A) Date - Assumes story is unread and within unread range
@ -170,7 +171,7 @@ def strip_tags(html):
return s.get_data()
def linkify(*args, **kwargs):
return linkify_tornado(*args, **kwargs)
return xhtml_unescape_tornado(linkify_tornado(*args, **kwargs))
def truncate_chars(value, max_length):
if len(value) <= max_length: