Show More
@@ -85,6 +85,9 b' class NotificationModel(BaseModel):' | |||||
85 | obj = self._get_user(u) |
|
85 | obj = self._get_user(u) | |
86 | if obj: |
|
86 | if obj: | |
87 | recipients_objs.append(obj) |
|
87 | recipients_objs.append(obj) | |
|
88 | else: | |||
|
89 | # TODO: inform user that requested operation couldn't be completed | |||
|
90 | log.error('cannot email unknown user %r', u) | |||
88 | recipients_objs = set(recipients_objs) |
|
91 | recipients_objs = set(recipients_objs) | |
89 | log.debug('sending notifications %s to %s' % ( |
|
92 | log.debug('sending notifications %s to %s' % ( | |
90 | type_, recipients_objs) |
|
93 | type_, recipients_objs) | |
@@ -95,6 +98,7 b' class NotificationModel(BaseModel):' | |||||
95 | log.debug('sending notifications %s to admins: %s' % ( |
|
98 | log.debug('sending notifications %s to admins: %s' % ( | |
96 | type_, recipients_objs) |
|
99 | type_, recipients_objs) | |
97 | ) |
|
100 | ) | |
|
101 | # TODO: inform user who are notified | |||
98 | notif = Notification.create( |
|
102 | notif = Notification.create( | |
99 | created_by=created_by_obj, subject=subject, |
|
103 | created_by=created_by_obj, subject=subject, | |
100 | body=body, recipients=recipients_objs, type_=type_ |
|
104 | body=body, recipients=recipients_objs, type_=type_ |
@@ -89,8 +89,6 b' class PullRequestModel(BaseModel):' | |||||
89 | revision_data = [(x.raw_id, x.message) |
|
89 | revision_data = [(x.raw_id, x.message) | |
90 | for x in map(org_repo.get_changeset, revisions)] |
|
90 | for x in map(org_repo.get_changeset, revisions)] | |
91 | #notification to reviewers |
|
91 | #notification to reviewers | |
92 | notif = NotificationModel() |
|
|||
93 |
|
||||
94 | pr_url = h.url('pullrequest_show', repo_name=other_repo.repo_name, |
|
92 | pr_url = h.url('pullrequest_show', repo_name=other_repo.repo_name, | |
95 | pull_request_id=new.pull_request_id, |
|
93 | pull_request_id=new.pull_request_id, | |
96 | qualified=True, |
|
94 | qualified=True, | |
@@ -114,9 +112,9 b' class PullRequestModel(BaseModel):' | |||||
114 | 'pr_revisions': revision_data |
|
112 | 'pr_revisions': revision_data | |
115 | } |
|
113 | } | |
116 |
|
114 | |||
117 |
|
|
115 | NotificationModel().create(created_by=created_by_user, subject=subject, body=body, | |
118 | recipients=reviewers, |
|
116 | recipients=reviewers, | |
119 | type_=Notification.TYPE_PULL_REQUEST, email_kwargs=kwargs) |
|
117 | type_=Notification.TYPE_PULL_REQUEST, email_kwargs=kwargs) | |
120 | return new |
|
118 | return new | |
121 |
|
119 | |||
122 | def update_reviewers(self, pull_request, reviewers_ids): |
|
120 | def update_reviewers(self, pull_request, reviewers_ids): |
General Comments 0
You need to be logged in to leave comments.
Login now