Skip to content

Commit

Permalink
Notify hunch creator, contributors when a comment is posted.
Browse files Browse the repository at this point in the history
  • Loading branch information
adammck committed Dec 5, 2011
1 parent af68a15 commit 82e56d9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions hunchworks/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ def comment_posted(sender, instance, created, **kwargs):

_attach(event, targets)

elif comment.hunch:

event = utils.create_event(
"comment_posted_to_hunch",
comment=comment
)

targets = _set(
comment.hunch,
comment.hunch.creator,
comment.hunch.user_profiles.all()
)

_attach(event, targets)



# user_invited(sender=Hunch)
def user_invited_to_hunch(sender, instance, inviter, invitee, message, **kwargs):
Expand Down
14 changes: 14 additions & 0 deletions hunchworks/templates/includes/events/comment_posted_to_hunch.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<article class="event comment-posted-hunch">
{% include "includes/users/short.html" with object=comment.creator %}

<div>
<p class="summary">
<a href="{% url profile comment.creator.pk }}">{{ comment.creator }}</a>
<span>commented</span> on
<a href="{% url hunch comment.hunch.pk %}" title="{{ comment.hunch }}">a hunch</a>
<time class="timeago" datetime="{{ now|date:"c" }}">{{ now }}</time>
</p>

<h2><a href="{{ comment.get_absolute_url }}">{{ comment.text }}</a></h2>
</div>
</article>

0 comments on commit 82e56d9

Please sign in to comment.