# HG changeset patch # User Marcin Kuzminski # Date 1359495629 -3600 # Node ID 32a283e5fd0dea7446c2abd3c9bc3f29d391f118 # Parent b67173bae3ff46305cef6a67ef8e8603549f870e Don't send notification email for auto-status changes diff -r b67173bae3ff -r 32a283e5fd0d rhodecode/model/changeset_status.py --- a/rhodecode/model/changeset_status.py Tue Jan 29 03:47:30 2013 +0100 +++ b/rhodecode/model/changeset_status.py Tue Jan 29 22:40:29 2013 +0100 @@ -132,10 +132,11 @@ if not comment: from rhodecode.model.comment import ChangesetCommentsModel comment = ChangesetCommentsModel().create( - text='Auto status change', + text='Auto status change to %s' % status, repo=repo, user=user, pull_request=pull_request, + send_email=False ) if revision: q = q.filter(ChangesetStatus.repo == repo) diff -r b67173bae3ff -r 32a283e5fd0d rhodecode/model/comment.py --- a/rhodecode/model/comment.py Tue Jan 29 03:47:30 2013 +0100 +++ b/rhodecode/model/comment.py Tue Jan 29 22:40:29 2013 +0100 @@ -58,7 +58,7 @@ return user_objects def create(self, text, repo, user, revision=None, pull_request=None, - f_path=None, line_no=None, status_change=None): + f_path=None, line_no=None, status_change=None, send_email=True): """ Creates new comment for changeset or pull request. IF status_change is not none this comment is associated with a @@ -72,6 +72,7 @@ :param f_path: :param line_no: :param status_change: + :param send_email: """ if not text: return @@ -164,25 +165,27 @@ repo_name=pull_request.other_repo.repo_name, qualified=True) } - # create notification objects, and emails - NotificationModel().create( - created_by=user, subject=subj, body=body, - recipients=recipients, type_=notification_type, - email_kwargs=email_kwargs - ) - mention_recipients = set(self._extract_mentions(body))\ - .difference(recipients) - if mention_recipients: - email_kwargs.update({'pr_mention': True}) - subj = _('[Mention]') + ' ' + subj + if send_email: + # create notification objects, and emails NotificationModel().create( created_by=user, subject=subj, body=body, - recipients=mention_recipients, - type_=notification_type, + recipients=recipients, type_=notification_type, email_kwargs=email_kwargs ) + mention_recipients = set(self._extract_mentions(body))\ + .difference(recipients) + if mention_recipients: + email_kwargs.update({'pr_mention': True}) + subj = _('[Mention]') + ' ' + subj + NotificationModel().create( + created_by=user, subject=subj, body=body, + recipients=mention_recipients, + type_=notification_type, + email_kwargs=email_kwargs + ) + return comment def delete(self, comment):