Files @ 28f3b8de08e7
Branch filter:

Location: website/conservancy/usethesource/templates/usethesource/comment_partial.html

bsturmfels
usethesource: Allow logged in users to edit/delete their own comments only

Unless of course they're given the "change comment" and "delete comment"
permissions, with which they can change or delete any comment.
<div class="mb4" hx-target="this" hx-swap="outerHTML">
  <div class="mb2">
    <strong>{% if comment.attribute_to %}{{ comment.attribute_to }}{% else %}{{ comment.user }}{% endif %}{{ comment.time }}</strong>
    {% if request.user == comment.user or perms.usethesource.change_comment %}
      <a href="#" class="f7 white bg-light-silver ph2" hx-get="{% url 'usethesource:edit_comment' comment_id=comment.id %}">edit</a>
    {% endif %}
    {% if request.user == comment.user or perms.usethesource.delete_comment %}
      <a href="#" class="f7 white bg-light-red ph2" hx-delete="{% url 'usethesource:delete_comment' comment_id=comment.id show_add='false' %}" hx-confirm="Are you sure you want to delete this comment?">delete</a>
    {% endif %}
  </div>
  {{ comment.message|urlize|linebreaksbr }}
</div>