aboutsummaryrefslogtreecommitdiff
path: root/rhodecode/model/comment.py
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2013-01-29 22:40:29 +0100
committerMarcin Kuzminski <marcin@python-works.com>2013-01-29 22:40:29 +0100
commit008d34682e222cb1f8946da2db7061b6c1b1b3f0 (patch)
tree35233a6bb499b2b249d602029aeec6cea65aca58 /rhodecode/model/comment.py
parent83844d92ac3760cd37f8dd690b2818a815a496fe (diff)
Don't send notification email for auto-status changes
--HG-- branch : beta
Diffstat (limited to 'rhodecode/model/comment.py')
-rw-r--r--rhodecode/model/comment.py33
1 files changed, 18 insertions, 15 deletions
diff --git a/rhodecode/model/comment.py b/rhodecode/model/comment.py
index 5cb6b1ad..0bf1b40b 100644
--- a/rhodecode/model/comment.py
+++ b/rhodecode/model/comment.py
@@ -58,7 +58,7 @@ class ChangesetCommentsModel(BaseModel):
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 @@ class ChangesetCommentsModel(BaseModel):
:param f_path:
:param line_no:
:param status_change:
+ :param send_email:
"""
if not text:
return
@@ -164,25 +165,27 @@ class ChangesetCommentsModel(BaseModel):
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):