Show More
@@ -92,22 +92,27 b' class ChangesetCommentsModel(BaseModel):' | |||
|
92 | 92 | ) |
|
93 | 93 | ) |
|
94 | 94 | body = text |
|
95 | ||
|
96 | # get the current participants of this changeset | |
|
95 | 97 | recipients = ChangesetComment.get_users(revision=revision) |
|
98 | ||
|
96 | 99 | # add changeset author |
|
97 | 100 | recipients += [User.get_by_email(author)] |
|
98 | 101 | |
|
99 |
NotificationModel().create( |
|
|
100 | body=body, recipients=recipients, | |
|
101 |
|
|
|
102 | NotificationModel().create( | |
|
103 | created_by=user_id, subject=subj, body=body, | |
|
104 | recipients=recipients, type_=Notification.TYPE_CHANGESET_COMMENT | |
|
105 | ) | |
|
102 | 106 | |
|
103 | 107 | mention_recipients = set(self._extract_mentions(body))\ |
|
104 | 108 | .difference(recipients) |
|
105 | 109 | if mention_recipients: |
|
106 | 110 | subj = _('[Mention]') + ' ' + subj |
|
107 |
NotificationModel().create( |
|
|
108 | body=body, | |
|
109 |
|
|
|
110 |
|
|
|
111 | NotificationModel().create( | |
|
112 | created_by=user_id, subject=subj, body=body, | |
|
113 | recipients=mention_recipients, | |
|
114 | type_=Notification.TYPE_CHANGESET_COMMENT | |
|
115 | ) | |
|
111 | 116 | |
|
112 | 117 | return comment |
|
113 | 118 |
@@ -85,13 +85,19 b' class NotificationModel(BaseModel):' | |||
|
85 | 85 | if obj: |
|
86 | 86 | recipients_objs.append(obj) |
|
87 | 87 | recipients_objs = set(recipients_objs) |
|
88 | log.debug('sending notifications %s to %s' % ( | |
|
89 | type_, recipients_objs) | |
|
90 | ) | |
|
88 | 91 | else: |
|
89 | 92 | # empty recipients means to all admins |
|
90 | 93 | recipients_objs = User.query().filter(User.admin == True).all() |
|
91 | ||
|
92 | notif = Notification.create(created_by=created_by_obj, subject=subject, | |
|
93 | body=body, recipients=recipients_objs, | |
|
94 | type_=type_) | |
|
94 | log.debug('sending notifications %s to admins: %s' % ( | |
|
95 | type_, recipients_objs) | |
|
96 | ) | |
|
97 | notif = Notification.create( | |
|
98 | created_by=created_by_obj, subject=subject, | |
|
99 | body=body, recipients=recipients_objs, type_=type_ | |
|
100 | ) | |
|
95 | 101 | |
|
96 | 102 | if with_email is False: |
|
97 | 103 | return notif |
General Comments 0
You need to be logged in to leave comments.
Login now