Permalink
Browse files

don't destroy entire conversations when comments are removed

  • Loading branch information...
1 parent 90414dd commit 2bc6e136b05b38ed579e8190011cc33c7787dfce Justine Tunney committed Aug 11, 2012
Showing with 54 additions and 51 deletions.
  1. +49 −45 occupywallst/templates/occupywallst/comment.html
  2. +5 −6 occupywallst/templatetags/ows.py
@@ -4,56 +4,60 @@
<div class="item comment" id="comment-{{ comment.id }}">
<div class="content {% if user and user.userinfo.can_moderate and comment.is_removed %}removed{% endif %}">
{% if comment.is_deleted %}
- <p class="deleted"><span>{% trans 'This comment was deleted D:' %}</span></p>
+ <p class="deleted"><span>{% trans '[Deleted]' %}</span></p>
{% else %}
- <div class="info">
- {% if extended %}
- Thread: <a href="{{ comment.article.get_absolute_url }}">{{ comment.article.title }}</a>
- <br />
- {% endif %}
- <a class="collapse" href="#">{% if comment.is_worthless %}[+]{% else %}[-]{% endif %}</a>
- <span class="karma">{{ comment.karma|localize }}</span> {% trans 'points' %}
- by <span>{{ comment.user|userlink }}</span>
- ({{ comment.user.userinfo.karma|localize }})
- {% if comment.user and comment.user.userinfo.city and comment.user.userinfo.region %}
+ {% if comment.is_removed and not user.userinfo.can_moderate %}
+ <p class="deleted"><span>{% trans '[Removed]' %}</span></p>
+ {% else %}
+ <div class="info">
+ {% if extended %}
+ Thread: <a href="{{ comment.article.get_absolute_url }}">{{ comment.article.title }}</a>
+ <br />
+ {% endif %}
+ <a class="collapse" href="#">{% if comment.is_worthless %}[+]{% else %}[-]{% endif %}</a>
+ <span class="karma">{{ comment.karma|localize }}</span> {% trans 'points' %}
+ by <span>{{ comment.user|userlink }}</span>
+ ({{ comment.user.userinfo.karma|localize }})
+ {% if comment.user and comment.user.userinfo.city and comment.user.userinfo.region %}
{% blocktrans with city=comment.user.userinfo.city region=comment.user.userinfo.region %}
from {{ city }}, {{ region }}
{% endblocktrans %}
- {% endif %}
- <span class="published">{{ comment.published|timesince_short }} {% trans 'ago' %}</span>
- </div>
- <div class="words">
- {% if comment.user.username == 'jart' %}
- {{ comment.content|markup_unsafe|nofollow }}
- {% else %}
- {{ comment.content|markup|strip_annoying_html|nofollow }}
- {% endif %}
- </div>
- <div class="links">
- <a class="up {% if comment.upvoted %}upvoted{% endif %}" href="#">{% trans '↥twinkle' %}</a>
- <a class="down {% if comment.downvoted %}downvoted{% endif %}" href="#">{% trans '↧stinkle' %}</a>
- {% if can_reply %}
- <a class="reply" href="#">{% trans 'reply' %}</a>
- {% endif %}
- {% if user and user.is_authenticated and user == comment.user %}
- <a class="edit" href="#">{% trans 'edit' %}</a>
- <a class="delete" href="#">{% trans 'delete' %}</a>
- {% endif %}
- <a class="permalink" href="{{ comment.get_absolute_url }}">{% trans 'permalink' %}</a>
- {% if user and user.userinfo.can_moderate %}
- | {% trans 'Mod:' %}
- <a class="ban" id="{{ comment.user.username }}" href="#" style="{% if comment.user.userinfo.is_shadow_banned %}display:none;{% endif %}">{% trans 'ban' %}</a>
- <a class="unban" id="{{ comment.user.username }}" href="#" style="{% if not comment.user.userinfo.is_shadow_banned %}display:none;{% endif %}">{% trans 'unban' %}</a>
- <a href="/admin/occupywallst/comment/?user={{ comment.user.id }}">comments</a>
- <a href="/admin/occupywallst/forumpost/?author={{ comment.user.id }}">threads</a>
- <a href="/admin/occupywallst/comment/{{ comment.id }}/">{% trans 'admin' %}</a>
- <a class="edit" href="#">{% trans 'edit' %}</a>
- <a class="remove" href="#">{% if comment.is_removed %}{% trans 'unremove' %}{% else %}{% trans 'remove' %}{% endif %}</a>
- {% if user.is_superuser %}
- <a href="/admin/occupywallst/comment/?ip=127.0.0.1">{{ comment.ip }} {{ comment.ip|ipcountry }}</a>
{% endif %}
- {% endif %}
- </div>
+ <span class="published">{{ comment.published|timesince_short }} {% trans 'ago' %}</span>
+ </div>
+ <div class="words">
+ {% if comment.user.username == 'jart' %}
+ {{ comment.content|markup_unsafe|nofollow }}
+ {% else %}
+ {{ comment.content|markup|strip_annoying_html|nofollow }}
+ {% endif %}
+ </div>
+ <div class="links">
+ <a class="up {% if comment.upvoted %}upvoted{% endif %}" href="#">{% trans '↥twinkle' %}</a>
+ <a class="down {% if comment.downvoted %}downvoted{% endif %}" href="#">{% trans '↧stinkle' %}</a>
+ {% if can_reply %}
+ <a class="reply" href="#">{% trans 'reply' %}</a>
+ {% endif %}
+ {% if user and user.is_authenticated and user == comment.user %}
+ <a class="edit" href="#">{% trans 'edit' %}</a>
+ <a class="delete" href="#">{% trans 'delete' %}</a>
+ {% endif %}
+ <a class="permalink" href="{{ comment.get_absolute_url }}">{% trans 'permalink' %}</a>
+ {% if user and user.userinfo.can_moderate %}
+ | {% trans 'Mod:' %}
+ <a class="ban" id="{{ comment.user.username }}" href="#" style="{% if comment.user.userinfo.is_shadow_banned %}display:none;{% endif %}">{% trans 'ban' %}</a>
+ <a class="unban" id="{{ comment.user.username }}" href="#" style="{% if not comment.user.userinfo.is_shadow_banned %}display:none;{% endif %}">{% trans 'unban' %}</a>
+ <a href="/admin/occupywallst/comment/?user={{ comment.user.id }}">comments</a>
+ <a href="/admin/occupywallst/forumpost/?author={{ comment.user.id }}">threads</a>
+ <a href="/admin/occupywallst/comment/{{ comment.id }}/">{% trans 'admin' %}</a>
+ <a class="edit" href="#">{% trans 'edit' %}</a>
+ <a class="remove" href="#">{% if comment.is_removed %}{% trans 'unremove' %}{% else %}{% trans 'remove' %}{% endif %}</a>
+ {% if user.is_superuser %}
+ <a href="/admin/occupywallst/comment/?ip=127.0.0.1">{{ comment.ip }} {{ comment.ip|ipcountry }}</a>
+ {% endif %}
+ {% endif %}
+ </div>
+ {% endif %}
{% endif %}
</div>
<div class="replies">
@@ -251,10 +251,9 @@ def show_comments(context, user, comments):
can_reply = depth + 1 < settings.OWS_MAX_COMMENT_DEPTH
is_mod = (user and user.id and user.userinfo.can_moderate())
for comment in comments:
- if not comment.is_removed or is_mod:
- res.append(render_to_string('occupywallst/comment.html',
- {'comment': comment,
- 'user': user,
- 'depth': depth,
- 'can_reply': can_reply}))
+ res.append(render_to_string('occupywallst/comment.html',
+ {'comment': comment,
+ 'user': user,
+ 'depth': depth,
+ 'can_reply': can_reply}))
return "".join(res)

0 comments on commit 2bc6e13

Please sign in to comment.