Show More
@@ -408,6 +408,8 b' def comment_pull_request(request, apiuse' | |||||
408 | line_no=None, |
|
408 | line_no=None, | |
409 | status_change=(ChangesetStatus.get_status_lbl(status) |
|
409 | status_change=(ChangesetStatus.get_status_lbl(status) | |
410 | if status and allowed_to_change_status else None), |
|
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 | closing_pr=False, |
|
413 | closing_pr=False, | |
412 | renderer=renderer |
|
414 | renderer=renderer | |
413 | ) |
|
415 | ) |
@@ -1363,9 +1363,11 b' def comment_commit(' | |||||
1363 | try: |
|
1363 | try: | |
1364 | rc_config = SettingsModel().get_all_settings() |
|
1364 | rc_config = SettingsModel().get_all_settings() | |
1365 | renderer = rc_config.get('rhodecode_markup_renderer', 'rst') |
|
1365 | renderer = rc_config.get('rhodecode_markup_renderer', 'rst') | |
1366 |
|
1366 | status_change_label = ChangesetStatus.get_status_lbl(status) | ||
1367 | comm = ChangesetCommentsModel().create( |
|
1367 | comm = ChangesetCommentsModel().create( | |
1368 |
message, repo, user, revision=commit_id, |
|
1368 | message, repo, user, revision=commit_id, | |
|
1369 | status_change=status_change_label, | |||
|
1370 | status_change_type=status, | |||
1369 | renderer=renderer) |
|
1371 | renderer=renderer) | |
1370 | if status: |
|
1372 | if status: | |
1371 | # also do a status change |
|
1373 | # also do a status change |
@@ -351,7 +351,8 b' class ChangesetController(BaseRepoContro' | |||||
351 | f_path=request.POST.get('f_path'), |
|
351 | f_path=request.POST.get('f_path'), | |
352 | line_no=request.POST.get('line'), |
|
352 | line_no=request.POST.get('line'), | |
353 | status_change=(ChangesetStatus.get_status_lbl(status) |
|
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 | # get status if set ! |
|
357 | # get status if set ! | |
357 | if status: |
|
358 | if status: |
@@ -762,6 +762,8 b' class PullrequestsController(BaseRepoCon' | |||||
762 | line_no=request.POST.get('line'), |
|
762 | line_no=request.POST.get('line'), | |
763 | status_change=(ChangesetStatus.get_status_lbl(status) |
|
763 | status_change=(ChangesetStatus.get_status_lbl(status) | |
764 | if status and allowed_to_change_status else None), |
|
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 | closing_pr=close_pr |
|
767 | closing_pr=close_pr | |
766 | ) |
|
768 | ) | |
767 |
|
769 |
@@ -82,7 +82,8 b' class ChangesetCommentsModel(BaseModel):' | |||||
82 | return global_renderer |
|
82 | return global_renderer | |
83 |
|
83 | |||
84 | def create(self, text, repo, user, revision=None, pull_request=None, |
|
84 | def create(self, text, repo, user, revision=None, pull_request=None, | |
85 |
f_path=None, line_no=None, status_change=None, |
|
85 | f_path=None, line_no=None, status_change=None, | |
|
86 | status_change_type=None, closing_pr=False, | |||
86 | send_email=True, renderer=None): |
|
87 | send_email=True, renderer=None): | |
87 | """ |
|
88 | """ | |
88 | Creates new comment for commit or pull request. |
|
89 | Creates new comment for commit or pull request. | |
@@ -96,7 +97,8 b' class ChangesetCommentsModel(BaseModel):' | |||||
96 | :param pull_request: |
|
97 | :param pull_request: | |
97 | :param f_path: |
|
98 | :param f_path: | |
98 | :param line_no: |
|
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 | :param closing_pr: |
|
102 | :param closing_pr: | |
101 | :param send_email: |
|
103 | :param send_email: | |
102 | """ |
|
104 | """ | |
@@ -144,6 +146,7 b' class ChangesetCommentsModel(BaseModel):' | |||||
144 | 'renderer_type': renderer, |
|
146 | 'renderer_type': renderer, | |
145 | 'repo_name': repo.repo_name, |
|
147 | 'repo_name': repo.repo_name, | |
146 | 'status_change': status_change, |
|
148 | 'status_change': status_change, | |
|
149 | 'status_change_type': status_change_type, | |||
147 | 'comment_body': text, |
|
150 | 'comment_body': text, | |
148 | 'comment_file': f_path, |
|
151 | 'comment_file': f_path, | |
149 | 'comment_line': line_no, |
|
152 | 'comment_line': line_no, |
@@ -854,6 +854,7 b' class PullRequestModel(BaseModel):' | |||||
854 | f_path=None, |
|
854 | f_path=None, | |
855 | line_no=None, |
|
855 | line_no=None, | |
856 | status_change=ChangesetStatus.get_status_lbl(status), |
|
856 | status_change=ChangesetStatus.get_status_lbl(status), | |
|
857 | status_change_type=status, | |||
857 | closing_pr=True |
|
858 | closing_pr=True | |
858 | ) |
|
859 | ) | |
859 |
|
860 |
@@ -1,5 +1,30 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
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 | ## headers we additionally can set for email |
|
28 | ## headers we additionally can set for email | |
4 | <%def name="headers()" filter="n,trim"></%def> |
|
29 | <%def name="headers()" filter="n,trim"></%def> | |
5 |
|
30 |
@@ -1,6 +1,6 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="base.mako"/> |
|
2 | <%inherit file="base.mako"/> | |
3 |
|
3 | <%namespace name="base" file="base.mako"/> | ||
4 |
|
4 | |||
5 | <%def name="subject()" filter="n,trim"> |
|
5 | <%def name="subject()" filter="n,trim"> | |
6 | <% |
|
6 | <% | |
@@ -82,7 +82,7 b' data = {' | |||||
82 | <tr><td style="padding-right:20px;">${_('Description')}</td><td>${h.urlify_commit_message(commit.message, repo_name)}</td></tr> |
|
82 | <tr><td style="padding-right:20px;">${_('Description')}</td><td>${h.urlify_commit_message(commit.message, repo_name)}</td></tr> | |
83 |
|
83 | |||
84 | % if status_change: |
|
84 | % if status_change: | |
85 |
<tr><td style="padding-right:20px;">${_('Status')}</td><td>${_('The commit status was changed to')}: ${status_change} |
|
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 | % endif |
|
86 | % endif | |
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> |
|
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 | </table> |
|
88 | </table> |
@@ -1,5 +1,6 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="base.mako"/> |
|
2 | <%inherit file="base.mako"/> | |
|
3 | <%namespace name="base" file="base.mako"/> | |||
3 |
|
4 | |||
4 |
|
5 | |||
5 | <%def name="subject()" filter="n,trim"> |
|
6 | <%def name="subject()" filter="n,trim"> | |
@@ -90,5 +91,8 b' data = {' | |||||
90 | </h4> |
|
91 | </h4> | |
91 | </td></tr> |
|
92 | </td></tr> | |
92 | <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> |
|
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 | <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> |
|
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 | </table> |
|
98 | </table> |
@@ -1,26 +1,37 b'' | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="base.mako"/> |
|
2 | <%inherit file="base.mako"/> | |
|
3 | <%namespace name="base" file="base.mako"/> | |||
3 |
|
4 | |||
4 | <%def name="subject()" filter="n,trim"> |
|
5 | <%def name="subject()" filter="n,trim"> | |
5 | ${_('%(user)s wants you to review pull request #%(pr_url)s: "%(pr_title)s"') % { |
|
6 | <% | |
6 | 'user': h.person(user), |
|
7 | data = { | |
7 | 'pr_title': pull_request.title, |
|
8 | 'user': h.person(user), | |
8 |
|
|
9 | 'pr_id': pull_request.pull_request_id, | |
9 | } |n} |
|
10 | 'pr_title': pull_request.title, | |
|
11 | } | |||
|
12 | %> | |||
|
13 | ||||
|
14 | ${_('%(user)s wants you to review pull request #%(pr_id)s: "%(pr_title)s"') % data |n} | |||
10 | </%def> |
|
15 | </%def> | |
11 |
|
16 | |||
12 |
|
17 | |||
13 | <%def name="body_plaintext()" filter="n,trim"> |
|
18 | <%def name="body_plaintext()" filter="n,trim"> | |
|
19 | <% | |||
|
20 | data = { | |||
|
21 | 'user': h.person(user), | |||
|
22 | 'pr_id': pull_request.pull_request_id, | |||
|
23 | 'pr_title': pull_request.title, | |||
|
24 | 'source_ref_type': pull_request.source_ref_parts.type, | |||
|
25 | 'source_ref_name': pull_request.source_ref_parts.name, | |||
|
26 | 'target_ref_type': pull_request.target_ref_parts.type, | |||
|
27 | 'target_ref_name': pull_request.target_ref_parts.name, | |||
|
28 | 'repo_url': pull_request_source_repo_url | |||
|
29 | } | |||
|
30 | %> | |||
14 | ${self.subject()} |
|
31 | ${self.subject()} | |
15 |
|
32 | |||
16 |
|
33 | |||
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') % |
|
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)} | |
18 | 'source_ref_type': pull_request.source_ref_parts.type, |
|
|||
19 | 'source_ref_name': pull_request.source_ref_parts.name, |
|
|||
20 | 'target_ref_type': pull_request.target_ref_parts.type, |
|
|||
21 | 'target_ref_name': pull_request.target_ref_parts.name, |
|
|||
22 | 'repo_url': pull_request_source_repo_url |
|
|||
23 | })} |
|
|||
24 |
|
35 | |||
25 |
|
36 | |||
26 | * ${_('Link')}: ${pull_request_url} |
|
37 | * ${_('Link')}: ${pull_request_url} | |
@@ -42,20 +53,33 b'' | |||||
42 |
|
53 | |||
43 | ${self.plaintext_footer()} |
|
54 | ${self.plaintext_footer()} | |
44 | </%def> |
|
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 | <table style="text-align:left;vertical-align:middle;"> |
|
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".') % |
|
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 | <tr><td style="padding-right:20px;padding-top:15px;">${_('Title')}</td><td style="padding-top:15px;">${pull_request.title}</td></tr> |
|
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> |
|
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> | |
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> |
|
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 | <tr><td style="padding-right:20px;">${_('Description')}</td><td style="white-space:pre-wrap">${pull_request.description}</td></tr> |
|
75 | <tr><td style="padding-right:20px;">${_('Description')}</td><td style="white-space:pre-wrap">${pull_request.description}</td></tr> | |
52 | <tr><td style="padding-right:20px;">${ungettext('%(num)s Commit', '%(num)s Commits', len(pull_request_commits)) % {'num': len(pull_request_commits)}}</td> |
|
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 | <td><ol style="margin:0 0 0 1em;padding:0;text-align:left;"> |
|
77 | <td><ol style="margin:0 0 0 1em;padding:0;text-align:left;"> | |
54 | % for commit_id, message in pull_request_commits: |
|
78 | % for commit_id, message in pull_request_commits: | |
55 | <li style="margin:0 0 1em;"><pre style="margin:0 0 .5em">${h.short_id(commit_id)}</pre> |
|
79 | <li style="margin:0 0 1em;"><pre style="margin:0 0 .5em">${h.short_id(commit_id)}</pre> | |
56 | ${h.chop_at_smart(message, '\n', suffix_if_chopped='...')} |
|
80 | ${h.chop_at_smart(message, '\n', suffix_if_chopped='...')} | |
57 | </li> |
|
81 | </li> | |
58 | % endfor |
|
82 | % endfor | |
59 | </ol></td> |
|
83 | </ol></td> | |
60 | </tr> |
|
84 | </tr> | |
61 | </table> |
|
85 | </table> |
General Comments 0
You need to be logged in to leave comments.
Login now