[finish #25980231] implemented a separate notification type for other commenters
person entering content doesn't get the notification duh if you've commented on a wishlist item, you only get the also commented notification, not the wishlist comment notificationpull/1/head
parent
729bc6e78d
commit
4d9e279862
|
@ -65,6 +65,7 @@ from notification import models as notification
|
|||
|
||||
def create_notice_types(app, created_models, verbosity, **kwargs):
|
||||
notification.create_notice_type("wishlist_comment", _("Wishlist Comment"), _("a comment has been received on one of your wishlist books"))
|
||||
notification.create_notice_type("coment_on_commented", _("Comment on Commented Work"), _("a comment has been received on a book that you've commented on"))
|
||||
|
||||
signals.post_syncdb.connect(create_notice_types, sender=notification)
|
||||
|
||||
|
@ -72,7 +73,10 @@ signals.post_syncdb.connect(create_notice_types, sender=notification)
|
|||
|
||||
from django.contrib.comments.signals import comment_was_posted
|
||||
def notify_comment(comment, request, **kwargs):
|
||||
notification.send(comment.content_object.wished_by(), "wishlist_comment", {'comment':comment}, True)
|
||||
other_commenters = User.objects.filter(comment_comments__content_type=comment.content_type, comment_comments__object_pk=comment.object_pk).distinct().exclude(id=comment.user.id)
|
||||
other_wishers = comment.content_object.wished_by().exclude(id=comment.user.id).exclude(id__in=other_commenters)
|
||||
notification.send(other_commenters, "coment_on_commented", {'comment':comment}, True)
|
||||
notification.send(other_wishers, "wishlist_comment", {'comment':comment}, True)
|
||||
|
||||
comment_was_posted.connect(notify_comment)
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{{ comment.user.username }} on {{ comment.content_object.title }}
|
||||
|
||||
{{ comment.comment }}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
{% with comment.content_object.id as id %}
|
||||
{% with comment.user as user %}
|
||||
<div class="comments {% cycle 'row1' 'row2' %}">
|
||||
<div class="nonavatar">
|
||||
<div class="image">
|
||||
<a href="{% url work id %}?tab=2"><img src="{{ comment.content_object.cover_image_thumbnail }}" alt="cover image" /></a>
|
||||
</div>
|
||||
<span><a href="{% url supporter supporter_username=user %}">{{ user.username }}</a> on <a href="{% url work id %}?tab=2">{{ comment.content_object.title }}</a></span><br />
|
||||
|
||||
<span class="text">{{ comment.comment|linebreaksbr }}</span>
|
||||
</div>
|
||||
|
||||
<div class="avatar">
|
||||
<a href="{% url supporter supporter_username=user %}">
|
||||
{% if supporter.profile.pic_url %}
|
||||
<img class="user-avatar" src="{{ comment.user.profile.pic_url }}" height="50" width="50" alt="Picture of {{ comment.user }}" title="{{ comment.user }}" />
|
||||
{% else %}
|
||||
<img class="user-avatar" src="/static/images/header/avatar.png" height="50" width="50" alt="Generic Ungluer Avatar" title="Ungluer" />
|
||||
{% endif %}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endwith %}
|
||||
{% endwith %}
|
|
@ -0,0 +1,5 @@
|
|||
{{ comment.user.username }} on {{ comment.content_object.title }}
|
||||
|
||||
{{ comment.comment }}
|
||||
|
||||
|
|
@ -0,0 +1 @@
|
|||
{{ comment.user.username }} has commented on {{ comment.content_object.title }}
|
Loading…
Reference in New Issue