# HG changeset patch # User Marcin Kuzminski # Date 2012-02-29 22:30:41 # Node ID 179604334d981a95b7aee46b89dfaebf0887f15c # Parent 77d215d6121f1c323e6fd081e4ec5b1184f5f402 code garden diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py --- a/rhodecode/model/comment.py +++ b/rhodecode/model/comment.py @@ -92,22 +92,27 @@ class ChangesetCommentsModel(BaseModel): ) ) body = text + + # get the current participants of this changeset recipients = ChangesetComment.get_users(revision=revision) + # add changeset author recipients += [User.get_by_email(author)] - NotificationModel().create(created_by=user_id, subject=subj, - body=body, recipients=recipients, - type_=Notification.TYPE_CHANGESET_COMMENT) + NotificationModel().create( + created_by=user_id, subject=subj, body=body, + recipients=recipients, type_=Notification.TYPE_CHANGESET_COMMENT + ) mention_recipients = set(self._extract_mentions(body))\ .difference(recipients) if mention_recipients: subj = _('[Mention]') + ' ' + subj - NotificationModel().create(created_by=user_id, subject=subj, - body=body, - recipients=mention_recipients, - type_=Notification.TYPE_CHANGESET_COMMENT) + NotificationModel().create( + created_by=user_id, subject=subj, body=body, + recipients=mention_recipients, + type_=Notification.TYPE_CHANGESET_COMMENT + ) return comment diff --git a/rhodecode/model/notification.py b/rhodecode/model/notification.py --- a/rhodecode/model/notification.py +++ b/rhodecode/model/notification.py @@ -85,13 +85,19 @@ class NotificationModel(BaseModel): if obj: recipients_objs.append(obj) recipients_objs = set(recipients_objs) + log.debug('sending notifications %s to %s' % ( + type_, recipients_objs) + ) else: # empty recipients means to all admins recipients_objs = User.query().filter(User.admin == True).all() - - notif = Notification.create(created_by=created_by_obj, subject=subject, - body=body, recipients=recipients_objs, - type_=type_) + log.debug('sending notifications %s to admins: %s' % ( + type_, recipients_objs) + ) + notif = Notification.create( + created_by=created_by_obj, subject=subject, + body=body, recipients=recipients_objs, type_=type_ + ) if with_email is False: return notif