# HG changeset patch # User durandn # Date 1470395198 -7200 # Node ID 4a63b6ac7a961b7c8c859bcff414bcf24b59e34b # Parent eb856f9b518cc7011930abb5c4d5a134e3690d99 fixed problem with duplicate notifications for annotation author diff -r eb856f9b518c -r 4a63b6ac7a96 src/iconolab/signals/handlers.py --- a/src/iconolab/signals/handlers.py Fri Aug 05 12:14:33 2016 +0200 +++ b/src/iconolab/signals/handlers.py Fri Aug 05 13:06:38 2016 +0200 @@ -73,12 +73,16 @@ comment_annotation = Annotation.objects.get(id=instance.object_pk) # Notifying new user comment if instance.parent_id: - if instance.user != comment_annotation.author: - notify.send(instance.user, recipient=comment_annotation.author, verb='a écrit un commentaire sur votre annotation', action_object=instance, target=comment_annotation) + notified_author = False + print("notifying! "+str(instance.parent_id)) if instance.level > 0: # We check parent_id as django comment xtd saves comments in two steps and only set the information we need in the second step parent_comment = IconolabComment.objects.get(id=instance.parent_id) + if parent_comment.user == comment_annotation.author: + notified_author = True notify.send(instance.user, recipient=parent_comment.user, verb='a répondu à votre commentaire', action_object=instance, target=comment_annotation) - + elif instance.user != comment_annotation.author and not notified_author: + notify.send(instance.user, recipient=comment_annotation.author, verb='a écrit un commentaire sur votre annotation', action_object=instance, target=comment_annotation) + def notify_users_on_metacategory(sender, instance, created, **kwargs): from iconolab.models import MetaCategory, MetaCategoryInfo, Annotation diff -r eb856f9b518c -r 4a63b6ac7a96 src/iconolab/templates/iconolab/detail_annotation.html --- a/src/iconolab/templates/iconolab/detail_annotation.html Fri Aug 05 12:14:33 2016 +0200 +++ b/src/iconolab/templates/iconolab/detail_annotation.html Fri Aug 05 13:06:38 2016 +0200 @@ -266,8 +266,9 @@ $(".reply-to-alert .reply-to-content").html(comment_content); $(".reply-to-alert .reply-to-subtext").html(comment_subtext); $(".reply-to-alert .reply-to-label-list").html(comment_labels); - $(".reply-to-container").slideDown(); - $("#form-reply-to-label").get(0).scrollIntoView(); + $(".reply-to-container").slideDown(complete=function(){ + $("#id_comment").get(0).scrollIntoView(); + }); $("#reply-to-field").val(commentID); }) $(".reply-to-cancel").click(function(event){