##// END OF EJS Templates
emails: added new tags to status sent...
marcink -
r548:1e26c289 default
parent child Browse files
Show More
@@ -408,6 +408,8 b' def comment_pull_request(request, apiuse'
408 408 line_no=None,
409 409 status_change=(ChangesetStatus.get_status_lbl(status)
410 410 if status and allowed_to_change_status else None),
411 status_change_type=(status
412 if status and allowed_to_change_status else None),
411 413 closing_pr=False,
412 414 renderer=renderer
413 415 )
@@ -1363,9 +1363,11 b' def comment_commit('
1363 1363 try:
1364 1364 rc_config = SettingsModel().get_all_settings()
1365 1365 renderer = rc_config.get('rhodecode_markup_renderer', 'rst')
1366
1366 status_change_label = ChangesetStatus.get_status_lbl(status)
1367 1367 comm = ChangesetCommentsModel().create(
1368 message, repo, user, revision=commit_id, status_change=status,
1368 message, repo, user, revision=commit_id,
1369 status_change=status_change_label,
1370 status_change_type=status,
1369 1371 renderer=renderer)
1370 1372 if status:
1371 1373 # also do a status change
@@ -351,7 +351,8 b' class ChangesetController(BaseRepoContro'
351 351 f_path=request.POST.get('f_path'),
352 352 line_no=request.POST.get('line'),
353 353 status_change=(ChangesetStatus.get_status_lbl(status)
354 if status else None)
354 if status else None),
355 status_change_type=status
355 356 )
356 357 # get status if set !
357 358 if status:
@@ -762,6 +762,8 b' class PullrequestsController(BaseRepoCon'
762 762 line_no=request.POST.get('line'),
763 763 status_change=(ChangesetStatus.get_status_lbl(status)
764 764 if status and allowed_to_change_status else None),
765 status_change_type=(status
766 if status and allowed_to_change_status else None),
765 767 closing_pr=close_pr
766 768 )
767 769
@@ -82,7 +82,8 b' class ChangesetCommentsModel(BaseModel):'
82 82 return global_renderer
83 83
84 84 def create(self, text, repo, user, revision=None, pull_request=None,
85 f_path=None, line_no=None, status_change=None, closing_pr=False,
85 f_path=None, line_no=None, status_change=None,
86 status_change_type=None, closing_pr=False,
86 87 send_email=True, renderer=None):
87 88 """
88 89 Creates new comment for commit or pull request.
@@ -96,7 +97,8 b' class ChangesetCommentsModel(BaseModel):'
96 97 :param pull_request:
97 98 :param f_path:
98 99 :param line_no:
99 :param status_change:
100 :param status_change: Label for status change
101 :param status_change_type: type of status change
100 102 :param closing_pr:
101 103 :param send_email:
102 104 """
@@ -144,6 +146,7 b' class ChangesetCommentsModel(BaseModel):'
144 146 'renderer_type': renderer,
145 147 'repo_name': repo.repo_name,
146 148 'status_change': status_change,
149 'status_change_type': status_change_type,
147 150 'comment_body': text,
148 151 'comment_file': f_path,
149 152 'comment_line': line_no,
@@ -854,6 +854,7 b' class PullRequestModel(BaseModel):'
854 854 f_path=None,
855 855 line_no=None,
856 856 status_change=ChangesetStatus.get_status_lbl(status),
857 status_change_type=status,
857 858 closing_pr=True
858 859 )
859 860
@@ -1,5 +1,30 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 ## helpers
4 <%def name="tag_button(text, tag_type=None)">
5 <%
6 color_scheme = {
7 'default': 'border:1px solid #979797;color:#666666;background-color:#f9f9f9',
8 'approved': 'border:1px solid #0ac878;color:#0ac878;background-color:#f9f9f9',
9 'rejected': 'border:1px solid #e85e4d;color:#e85e4d;background-color:#f9f9f9',
10 'under_review': 'border:1px solid #ffc854;color:#ffc854;background-color:#f9f9f9',
11 }
12 %>
13 <pre style="display:inline;border-radius:2px;font-size:12px;padding:.2em;${color_scheme.get(tag_type, color_scheme['default'])}">${text}</pre>
14 </%def>
15
16 <%def name="status_text(text, tag_type=None)">
17 <%
18 color_scheme = {
19 'default': 'color:#666666',
20 'approved': 'color:#0ac878',
21 'rejected': 'color:#e85e4d',
22 'under_review': 'color:#ffc854',
23 }
24 %>
25 <span style="font-weight:bold;font-size:12px;padding:.2em;${color_scheme.get(tag_type, color_scheme['default'])}">${text}</span>
26 </%def>
27
3 28 ## headers we additionally can set for email
4 29 <%def name="headers()" filter="n,trim"></%def>
5 30
@@ -1,6 +1,6 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="base.mako"/>
3
3 <%namespace name="base" file="base.mako"/>
4 4
5 5 <%def name="subject()" filter="n,trim">
6 6 <%
@@ -82,7 +82,7 b' data = {'
82 82 <tr><td style="padding-right:20px;">${_('Description')}</td><td>${h.urlify_commit_message(commit.message, repo_name)}</td></tr>
83 83
84 84 % if status_change:
85 <tr><td style="padding-right:20px;">${_('Status')}</td><td>${_('The commit status was changed to')}: ${status_change}.</td></tr>
85 <tr><td style="padding-right:20px;">${_('Status')}</td><td>${_('The commit status was changed to')}: ${base.status_text(status_change, tag_type=status_change_type)}</td></tr>
86 86 % endif
87 87 <tr><td style="padding-right:20px;">${(_('Comment on line: %(comment_line)s') if comment_file else _('Comment')) % data}</td><td style="line-height:1.2em;">${h.render(comment_body, renderer=renderer_type, mentions=True)}</td></tr>
88 88 </table>
@@ -1,5 +1,6 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="base.mako"/>
3 <%namespace name="base" file="base.mako"/>
3 4
4 5
5 6 <%def name="subject()" filter="n,trim">
@@ -90,5 +91,8 b' data = {'
90 91 </h4>
91 92 </td></tr>
92 93 <tr><td style="padding-right:20px;padding-top:15px;">${_('Source')}</td><td style="padding-top:15px;"><a style="color:#427cc9;text-decoration:none;cursor:pointer" href="${pr_source_repo_url}">${pr_source_repo.repo_name}</a></td></tr>
94 % if status_change:
95 <tr><td style="padding-right:20px;">${_('Submitted status')}</td><td>${base.status_text(status_change, tag_type=status_change_type)}</td></tr>
96 % endif
93 97 <tr><td style="padding-right:20px;">${(_('Comment on line: %(comment_line)s') if comment_file else _('Comment')) % data}</td><td style="line-height:1.2em;">${h.render(comment_body, renderer=renderer_type, mentions=True)}</td></tr>
94 98 </table>
@@ -1,26 +1,37 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="base.mako"/>
3 <%namespace name="base" file="base.mako"/>
3 4
4 5 <%def name="subject()" filter="n,trim">
5 ${_('%(user)s wants you to review pull request #%(pr_url)s: "%(pr_title)s"') % {
6 <%
7 data = {
6 8 'user': h.person(user),
9 'pr_id': pull_request.pull_request_id,
7 10 'pr_title': pull_request.title,
8 'pr_url': pull_request.pull_request_id
9 } |n}
11 }
12 %>
13
14 ${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s"') % data |n}
10 15 </%def>
11 16
12 17
13 18 <%def name="body_plaintext()" filter="n,trim">
14 ${self.subject()}
15
16
17 ${h.literal(_('Pull request from %(source_ref_type)s:%(source_ref_name)s of %(repo_url)s into %(target_ref_type)s:%(target_ref_name)s') % {
19 <%
20 data = {
21 'user': h.person(user),
22 'pr_id': pull_request.pull_request_id,
23 'pr_title': pull_request.title,
18 24 'source_ref_type': pull_request.source_ref_parts.type,
19 25 'source_ref_name': pull_request.source_ref_parts.name,
20 26 'target_ref_type': pull_request.target_ref_parts.type,
21 27 'target_ref_name': pull_request.target_ref_parts.name,
22 28 'repo_url': pull_request_source_repo_url
23 })}
29 }
30 %>
31 ${self.subject()}
32
33
34 ${h.literal(_('Pull request from %(source_ref_type)s:%(source_ref_name)s of %(repo_url)s into %(target_ref_type)s:%(target_ref_name)s') % data)}
24 35
25 36
26 37 * ${_('Link')}: ${pull_request_url}
@@ -42,12 +53,25 b''
42 53
43 54 ${self.plaintext_footer()}
44 55 </%def>
45
56 <%
57 data = {
58 'user': h.person(user),
59 'pr_id': pull_request.pull_request_id,
60 'pr_title': pull_request.title,
61 'source_ref_type': pull_request.source_ref_parts.type,
62 'source_ref_name': pull_request.source_ref_parts.name,
63 'target_ref_type': pull_request.target_ref_parts.type,
64 'target_ref_name': pull_request.target_ref_parts.name,
65 'repo_url': pull_request_source_repo_url,
66 'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url),
67 'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url)
68 }
69 %>
46 70 <table style="text-align:left;vertical-align:middle;">
47 <tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${pull_request_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % { 'user': h.person(user), 'pr_title': pull_request.title, 'pr_id': pull_request.pull_request_id } }</a></h4></td></tr>
71 <tr><td colspan="2" style="width:100%;padding-bottom:15px;border-bottom:1px solid #dbd9da;"><h4><a href="${pull_request_url}" style="color:#427cc9;text-decoration:none;cursor:pointer">${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s".') % data }</a></h4></td></tr>
48 72 <tr><td style="padding-right:20px;padding-top:15px;">${_('Title')}</td><td style="padding-top:15px;">${pull_request.title}</td></tr>
49 <tr><td style="padding-right:20px;">${_('Source')}</td><td><pre style="display:inline;border-radius:2px;color:#666666;font-size:12px;background-color:#f9f9f9;padding:.2em;border:1px solid #979797;">${pull_request.source_ref_parts.name}</pre>${h.literal(_('%(source_ref_type)s of %(source_repo_url)s') % {'source_ref_type': pull_request.source_ref_parts.type, 'source_repo_url': h.link_to(pull_request_source_repo.repo_name, pull_request_source_repo_url)})}</td></tr>
50 <tr><td style="padding-right:20px;">${_('Target')}</td><td><pre style="display:inline;border-radius:2px;color:#666666;font-size:12px;background-color:#f9f9f9;padding:.2em;border:1px solid #979797;">${pull_request.target_ref_parts.name}</pre>${h.literal(_('%(target_ref_type)s of %(target_repo_url)s') % {'target_ref_type': pull_request.target_ref_parts.type, 'target_repo_url': h.link_to(pull_request_target_repo.repo_name, pull_request_target_repo_url)})}</td></tr>
73 <tr><td style="padding-right:20px;">${_('Source')}</td><td>${base.tag_button(pull_request.source_ref_parts.name)} ${h.literal(_('%(source_ref_type)s of %(source_repo_url)s') % data)}</td></tr>
74 <tr><td style="padding-right:20px;">${_('Target')}</td><td>${base.tag_button(pull_request.target_ref_parts.name)} ${h.literal(_('%(target_ref_type)s of %(target_repo_url)s') % data)}</td></tr>
51 75 <tr><td style="padding-right:20px;">${_('Description')}</td><td style="white-space:pre-wrap">${pull_request.description}</td></tr>
52 76 <tr><td style="padding-right:20px;">${ungettext('%(num)s Commit', '%(num)s Commits', len(pull_request_commits)) % {'num': len(pull_request_commits)}}</td>
53 77 <td><ol style="margin:0 0 0 1em;padding:0;text-align:left;">
General Comments 0
You need to be logged in to leave comments. Login now