allura
リビジョン | b8e16105e119988011f5ae3638eaf803e882cb0e (tree) |
---|---|
日時 | 2012-05-30 01:00:12 |
作者 | bolkimen <bolkimen@yaho...> |
コミッター | Dave Brondsema |
[#3775] ticket:70 update commit messages
@@ -149,6 +149,7 @@ class Notification(MappedClass): | ||
149 | 149 | from_address=reply_to, |
150 | 150 | reply_to_address=reply_to, |
151 | 151 | subject=subject_prefix + subject, |
152 | + text=kwargs.pop('text', subject), | |
152 | 153 | author_id=c.user._id, |
153 | 154 | pubdate=datetime.utcnow()) |
154 | 155 | if c.user.get_pref('email_address'): |
@@ -159,19 +160,6 @@ class Notification(MappedClass): | ||
159 | 160 | d['from_address'] = '"%s" <%s>' % ( |
160 | 161 | c.user.get_pref('display_name'), |
161 | 162 | c.user.email_addresses[0]) |
162 | - | |
163 | - email_format = 'plain' | |
164 | - if c.user.get_pref('email_format'): | |
165 | - email_format = c.user.get_pref('email_format') | |
166 | - email_text = kwargs.pop('text', subject) | |
167 | - if email_format == 'plain': | |
168 | - # Here we render text message | |
169 | - d['text'] = email_text | |
170 | - else: | |
171 | - # For html or both we render html text | |
172 | - md = g.forge_markdown(email=True) | |
173 | - d['text'] = md.convert(email_text) | |
174 | - | |
175 | 163 | if not d.get('text'): |
176 | 164 | d['text'] = '' |
177 | 165 | try: |
@@ -327,7 +327,7 @@ def send_notifications(repo, commit_ids): | ||
327 | 327 | author_link=ci.author_url, |
328 | 328 | author_name=ci.authored.name) |
329 | 329 | branches = repo.symbolics_for_commit(ci.legacy)[0] |
330 | - commit_msgs.append('[%s] %s by %s %s%s' % ( | |
330 | + commit_msgs.append('%s: %s by %s %s%s' % ( | |
331 | 331 | ",".join(b for b in branches), |
332 | 332 | summary, ci.authored.name, base_url, ci.url())) |
333 | 333 | if commit_msgs: |
@@ -341,7 +341,11 @@ def send_notifications(repo, commit_ids): | ||
341 | 341 | repo.app.project.name, |
342 | 342 | repo.app.config.options.mount_label, |
343 | 343 | summary) |
344 | - text = ci.message | |
344 | + branches = repo.symbolics_for_commit(ci.legacy)[0] | |
345 | + text = "%s: %s %s%s" % (",".join(b for b in branches), | |
346 | + ci.message, | |
347 | + base_url, ci.url()) | |
348 | + | |
345 | 349 | Notification.post( |
346 | 350 | artifact=repo, |
347 | 351 | topic='metadata', |
@@ -359,7 +359,7 @@ class Repository(Artifact): | ||
359 | 359 | author_name = ci.authored.name, |
360 | 360 | ) |
361 | 361 | branches = ci.symbolic_ids[0] |
362 | - commit_msgs.append('[%s] %s by %s %s%s' % ( | |
362 | + commit_msgs.append('%s: %s by %s %s%s' % ( | |
363 | 363 | ",".join(b for b in branches), |
364 | 364 | h.really_unicode(ci.summary), h.really_unicode(ci.committed.name), base_url, ci.url())) |
365 | 365 | if commit_msgs: |
@@ -373,7 +373,13 @@ class Repository(Artifact): | ||
373 | 373 | self.app.project.name, |
374 | 374 | self.app.config.options.mount_label, |
375 | 375 | h.really_unicode(ci.summary)) |
376 | - text = h.really_unicode(ci.message) | |
376 | + ci.set_context(self) | |
377 | + branches = ci.symbolic_ids[0] | |
378 | + message = "%s: %s %s%s" % (",".join(b for b in branches), | |
379 | + ci.message, | |
380 | + base_url, ci.url()) | |
381 | + text = h.really_unicode(message) | |
382 | + log.info("SUBJ: %s MESSAGE: %s" % (subject, text)) | |
377 | 383 | Notification.post( |
378 | 384 | artifact=self, |
379 | 385 | topic='metadata', |
@@ -169,7 +169,7 @@ class TestRepo(_TestWithRepo): | ||
169 | 169 | notifications = M.Notification.query.find().all() |
170 | 170 | for n in notifications: |
171 | 171 | if '100 new commits' in n.subject: |
172 | - assert "[master,branch] by Test Committer http://localhost/#" in n.text | |
172 | + assert "master,branch: by Test Committer http://localhost/#" in n.text | |
173 | 173 | break |
174 | 174 | else: |
175 | 175 | assert False, 'Did not find notification' |