Changeset - 179604334d98
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 14 years ago 2012-02-29 23:30:41
marcin@python-works.com
code garden
2 files changed with 21 insertions and 10 deletions:
0 comments (0 inline, 0 general)
rhodecode/model/comment.py
Show inline comments
 
@@ -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,
 
                NotificationModel().create(
 
                    created_by=user_id, subject=subj, body=body,
 
                                    recipients=mention_recipients,
 
                                    type_=Notification.TYPE_CHANGESET_COMMENT)
 
                    type_=Notification.TYPE_CHANGESET_COMMENT
 
                )
 

	
 
            return comment
 

	
rhodecode/model/notification.py
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)